How to use set_select on a multiple select box in codeigniter?
This is an example of multi select box in codeigniter
<select multiple class="form-control" name="city[]" id="city" style="height: 123px !important;">
<?php $cities = getCitieslist();
foreach ($cities as $city) {
?>
<option value="<?php echo $city->id?>" <?php if(@in_array($city->id, set_value('city[]'))): ?> selected="selected"<?php endif; ?>>
<?php echo $city->fk_name.' - '.$city->description?>
</option>
<?php } ?>
</select>
You can take a look above code or In simple code you can select the multiple value
<?php if(@in_array($city->id, set_value('city[]'))): ?> selected="selected"<?php endif; ?>
Lots of people search above term like how to use set_value for multi select box in codeigniter
<select multiple class="form-control" name="city[]" id="city" style="height: 123px !important;">
<?php $cities = getCitieslist();
foreach ($cities as $city) {
?>
<option value="<?php echo $city->id?>" <?php if(@in_array($city->id, set_value('city[]'))): ?> selected="selected"<?php endif; ?>>
<?php echo $city->fk_name.' - '.$city->description?>
</option>
<?php } ?>
</select>
You can take a look above code or In simple code you can select the multiple value
<?php if(@in_array($city->id, set_value('city[]'))): ?> selected="selected"<?php endif; ?>
Lots of people search above term like how to use set_value for multi select box in codeigniter
Comments
Post a Comment