I have a problem to put <?php echo $myArray[0] === 'true' ? 'checked' : ''; ?>
into <input type="checkbox" id="checkbox_val" name="checkbox_val" value="1" >
. Because I need to define checked in the input. Hope someone can guide me on how to solve this problem.
Below is my sample code, but cannot work:
<?php
$check_value = 'true,false,false,false,true,false,false';
$myArray = explode(',', $check_value);
foreach ($myArray as $k => $va) {
}
foreach ($result_arr_user as $val_user) {
$checkbox = '<input type="checkbox" id="checkbox_val" name="checkbox_val" value="1" echo $myArray[0] === 'true' ? 'checked' : ''; > ';
}
?>
Aucun commentaire:
Enregistrer un commentaire