lundi 26 janvier 2015

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

I try form validation in codeigniter. how Re-populate checkbox which value come from database if it fails in validation in an edit form in Codeigniter.OR How





<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>
</tr>
<tr>
<td>Genre</td>
<td>
<?php
if(!empty($mid))
{
$g=explode(",",$movie1['genre']);
}
foreach($genre as $getd)
{
echo"<input type='checkbox' name='genre[]'";
if(!empty($mid))
{
if(in_array($getd['name'],$g))
{
echo"checked='checked' ";
}
}
echo"value='".$getd['name']."'>".$getd['name'];
}
?>
</td>
</tr>



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





Aucun commentaire:

Enregistrer un commentaire