I have the following form -
echo "<form action=\"wishlist.php\" method=\"post\" target=\"_self\">"
."<table border=\"1\">"
."<tr>"
."<td>Date</td>"
."<td>Time</td>"
."<td>Name</td>"
."<td>Item</td>"
."<td>Item found?</td>"
."</tr>";
do {
echo "<tr>"
."<td><input name=\"id\" type=\"hidden\" value=".$row_wishlist['index'].">".$row_wishlist['dateentered']."</td>"
."<td>".$row_wishlist['timeentered']."</td>"
."<td>".$row_wishlist['name']."</td>"
."<td>".$row_wishlist['itemrequired']."</td>"
."<td>";
if ($row_wishlist['itemfound'] == "1"){
echo "<input name=\"itemfound\" type=\"checkbox\" value=\"true\" checked></td>";
}
else {
echo "<input name=\"itemfound\" type=\"checkbox\" value=\"false\"></td>";
}
echo "</tr>";
} while ($row_wishlist = mysql_fetch_assoc($result));
echo "</table>"
."<br>"
."found by - <input name=\"foundby\">"
."<input type=\"submit\" name=\"update\" value=\"Update records\">"
."</form>";
what happens is that the records are retrieved from the DB and displayed in a table.
What i want to happen is that the checkbox next to each record can be checked/unchecked and then updated by pressing the update button.
The problem is i am not sure of the code that will be required. I'm guessing that the form will need to by some sort of array that is iterated through until the end is reached. In the loop a check could be made against the value of the checkbox - if changed then updateing the DB, if not then moving to the next record.
Can anyone help with the code at all?