I'm writing a system and have a checkbox in a form.
My problem is, when i press the edit button, the checkbox cannot show me the tick in the checkbox, I have tried to change checkbox type to text, it can show me the value. I have set the value if value = 1 is tick, if value = 0 is no tick. How can shows up tick in the form? Anyone can guide me to solve it?
Below is my coding:
Checkbox
<input type="checkbox" name="rm_option" id="rm_option" value="1" <?php if(_POST[$value]=='1'){echo "checked='checked'";} ?> ><strong> RM </strong></input>
<input type="checkbox" name="point_option" id="point_option" value="1" <?php if(_POST[$value]=='1'){echo "checked='checked'";} ?>><strong> Full Point </strong></input>
<input type="checkbox" name="partial_option" id="partial_option" value="1" <?php if(_POST[$value]=='1'){echo "checked='checked'";} ?>><strong> Partial Point + RM </strong></input>
Checkbox function
<?php
$sql = "select * from promotion_list where id=" . $_GET['id'];
$arr_sql = db_conn_select($sql);
foreach ($arr_sql as $rs_sql) {
foreach ($rs_sql as $key => $value) {
?>
$("#<?php echo $key ?>").val("<?php echo $value?>");
<?php
}
?>
When I press the edit button, other column can show up in the form, only the checkbox cannot show me the tick. Below is the output picture:
If I change Checkbox type to text, below is the output
I have stuck in this problem already 1 week, hope someone coding hero can guide me to solve this problem. Thanks a lot.
Aucun commentaire:
Enregistrer un commentaire