I display a form which shows every record from my mysql table
I'm trying to turn the display field for the record to either 1 or 0 (depending on if the box is checked or not)
I got the form to display
while($row = $stmt->fetch()) {
switch($row['display']) {
case 1:
$display = 'checked';
break;
default:
$display = '';
break;
}
echo '<tr>';
echo "<td>".$row['id']."</td>";
echo '<td>'.$row['userName'].' ('.$row['userID'].')</td>';
echo '<td><input type="hidden" name="userID['.$row['id'].']" value="'.$row['id'].'"><input type="checkbox" name="display['.$row['id'].']" value="'.$row['display'].'" '.$display.'></td>';
echo '</tr>';
echo "\r\n";
But how do I make it so that once the form is submitted, i only change the changed display property (1 or 0) in the mysql table?
Thanks