You need to do this while you are printing out the form to the browser from PHP...
so - first you need to select the field/s from the database that are to be used from propagating the form fields and then check their state to place into the form fields.....
i.e.
// DB setup already done
$result = mysql_query('SELECT checkval FROM my_table');
if ($result)
{
$row = mysql_fetch_array($result);
$strVal = $row['checkval'];
}
echo '<input type="checkbox" name="my_checkbox"' . ($strVal=='yes'?' checked':'') . '>';
This uses the .ternary conditional operator (?: ) in the last echo line, which you may or may not be familiar with, the alternative would be something like...
echo '<input type="checkbox" name="my_checkbox"';
if ($strVal=='yes')
{
echo ' checked';
}
echo '>';
Anyhow - hope this helps you somehow 🙂