php - How could I display a checked checkbox based from it's value in the database? -
i'm new in php, me solve problem? i'm trying display checkbox checked based on value in database. have saved value 1 if it's checked , 0 if it's not.
<?php $sql = "select somecol sometable"; $result = mysql_query($sql); $row = mysql_fetch_array($result); $checked = $result['somecol']; ?> <input type="checkbox" name="somecol" value="1" <?php if ($checked == 1) echo 'checked'; ?> />
Comments
Post a Comment