Menu
  • HOME
  • TAGS

Re-populate dynamic generated checkbox if it fails in validation in an edit form in Codeigniter

php,codeigniter,checkbox,repopulation

Add this statement after value attribute show the correct code. if(validation_errors()){echo set_checkbox('genre[]', $getd['name']);} <tr> <td>Title</td> <td><input type="text" name="title" value="<?php if(!empty($mid)){echo $movie1['title'];}elseif(validation_errors()){echo set_value('title'); } ?>"></td> <td><?php echo form_error('title'); ?></td> </tr> <tr> <td>Genre</td> <td> <?php if(!empty($mid)) { $g=explode(",",$movie1['genre']); }...