Hi,
I'm trying to check a box in a form based on the $status variable read from a json file. If it's a 1 then the checkbox is checked, otherwise not.
If I check/uncheck it, then the $status is written back to the json file. It's a rather simple code but I just cannot get it right.
I appreciate any help.
TIA
<div class="field">
<?php
if ($status == 1){
$checked = "checked";
}
echo '<input name="ck1" type="checkbox" value='.$status.' '.$checked.' >';
?>
<label for="ck1">Active</label>
<!-- <input name='ck1' type='checkbox' <? if $status : "checked" ?> value = "<?=$status ?>" /> -->
</div>