How to add checked="yes" from a php mysql result when $row['checkbox'] == input.value?
for example: If now $row['checkbox']='3' How to add checked="yes" in <li><input type="checkbox" name="my_check" value="3" checked="yes" />Guangzhou</li>? Thanks.
<?php
// db_connect, mysql_query
while($row = mysql_fetch_array($query)){
// If($row['checkbox']='3)
?>
<li><input type="checkbox" name="my_check" value="1" />Beijing</li>
<li><input type="checkbox" name="my_check" value="2" />Shanghai</li>
<li><input type="checkbox" name="my_check" value="3" />Guangzhou</li>
<li><input type="checkbox" name="my_check" value="4" />Chongqin</li>
<li><input type="checkbox" name="my_check" value="5" />Tianjing</li>
<li><input type="checkbox" name="my_check" value="6" />Chengdu</li>
<li><input type="checkbox" name="my_check" value="7" />Wuhan</li>
<li><input type="checkbox" name="my_check" value="8" />Nanjing</li>
<li><input type="checkbox" name="my_check" value="9" />Shenzhen</li>
<li><input type="checkbox" name="my_check" value="10" />Hangzhou</li>
<li><input type="checkbox" name="my_check" value="11" />Ningbo</li>
<?php
}
?>
<?php if($row['checkbox']=='3') echo 'checked="yes"' ?>in eachinput, however, in my page, I have more than 100checkbox. any easy way? Thanks.