Hi!
I am new in PHP.
I have a table which stores user surnames and 12 months each having a value of 1 or 0.
I need via a form in PHP to check whether or not this value is 1 or 0,
and be able to control this values via checkboxes (when the value is 1 the checkbox is checked and viseversa: when the checkbox is checked, then update the database.
The code I wrote is this:
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Surname'] . "</td>";
$rownum=mysql_num_rows($result);
if ($row['Jan']==1)
{
echo "<td><input type='checkbox' name='month[$row]' checked='True'/>" . "</td>";
}
else
{
echo "<td><input type='checkbox' name='month[$row]' checked='False'/>" . "</td>";
}
It displays the 2 users I already have, but if the value in the database is 1 then for both users the checkbox gets checked...
Any help appreciated