php - Multi select dropdown - how to add default value -
i'm trying add default value in multiselect dropdown, far tried <select name="addons[]" multiple="multiple" id="addons"> <option value="not selected" <?php echo set_select('addons[]', 'not selected', true); ?> >not selected</option> <?php foreach ($addons $options) { ?> <option value="<?php echo $options->addon_name; ?>"><h5><?php echo $options->addon_name; ?></h5></option> <?php } ?> </select> i should suppose default value "not selected" i'm getting empty. 1 knows i'm going wrong ? <select name="addons[]" multiple="multiple" id="addons"> <option value="not selected" <?php echo in_array("not selected",$addons)?"selected":"" ?> >not selected</option> <?php foreac...