Edit file File name : p_aminities.php Content :<div class="row"> <?php $selected=explode(",",$data->aminities); ?> <div class="card col-md-12"> <div class="card-body"> <?=form_open('Properties/Edit_aminities',['enctype'=>'multipart/form-data'])?> <input type="hidden" name="id" value="<?=$data->id?>"> <input type="hidden" name="aminities" value="<?=$data->aminities?>" > <select multiple required name="new_aminities[]" class="js-example-basic-multiple form-control" > <?php foreach($aminities as $am){ ?> <option value="<?=$am->name?>" <?php if(in_array($am->name,$selected)){ echo "selected"; } ?>><?=$am->name?></option> <?php } ?> </select> <input type="submit" style="float:left;width:50%;" class="btn-success" value="Update"> <?=form_close()?> </div> </div> </div> Save