Html code:
<input type="checkbox" id="my_data" name="my_data" value="1" <?php echo($my_data == 1 ? 'checked' : ''); ?>/>
Controller code:
$my_data_val = isset($_POST['my_data']) && $_POST['my_data'] ? "1" : "0";
$data["my_data"] = $my_data_val;
i want checked the check box by default while page loading.
Error result : check box value 0 or unchecked while page loading.
Aucun commentaire:
Enregistrer un commentaire