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

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -