Here is my code:
<?php
$results = array();
$cval = explode(',', $row['fruits']);
?>
<input type="checkbox" name="fruit[]" value="apple" <?php in_array('apple', $cval)?'checked':'' ?>>Apple
<input type="checkbox" name="fruit[]" value="banana" <?php in_array('banana', $cval)?'checked':'' ?>>Banana
<input type="checkbox" name="fruit[]" value="mango" <?php in_array('mango', $cval)?'checked':'' ?>>Mango
<input type="checkbox" name="fruit[]" value="pp" <?php in_array('pp', $cval)?'checked':'' ?>>PP
<input type="hidden" name="id" value="<?php echo $row['id']?>"><br>
<input type="submit" name="update" value="Update">
on print_r($cval)
it gives : Array ( [0] => banana [1] => mango [2] => pp )
But checked is remain unchecked?
Whats the mistake? Help me
Aucun commentaire:
Enregistrer un commentaire