I have an array like this
$current_asset = [
['name'=>'Land,'id'=>1],
['name'=>'Building ,'id'=>2],
['name'=>'Machinery','id'=>3],
];
<?php
foreach($current_asset as $key=>$value){ ?>
<input type="checkbox" name="current_asset[]" value="<?php echo $value['id'] ?>">
<?php } ?>
My question how can I add checked attribute in if one of the value is checked.
I am getting the checkbox array like this on form submit
[current_asset] => Array
(
[0] => 1
[1] => 2
)
Aucun commentaire:
Enregistrer un commentaire