I'd like to be able to update several items at once via checkbox selection, and I'm not sure how to go about it....
Basically, I've created a table via a query to my db, and I've printed out each row and included a checkbox for each.
I'd like to select as many checkboxes as needed and then click "Update", which will then set all the values to "Yes" in my db.
$query = "SELECT * FROM MyTable WHERE Status='On'";
$result = mysql_query($query);
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
$id = $row['OfferID'];
$row_color = ($row_count % 2) ? $color1 : $color2;
echo "<tr valign=\"top\" height=\"40\">";
echo "<td bgcolor=\"$row_color\">{$row['ID']}</td>
<td bgcolor=\"$row_color\">{$row['Headline']}</td>
<td align=\"center\" bgcolor=\"$row_color\">
<input type=\"checkbox\" name=\"thisOK[]\" value=\"Yes\">
</td></tr>";
$row_count++;
}
echo "<tr><td colspan=\"8\"><input type=\"submit\" name=\"update\" value=\"Update\"></td></tr>";
echo "</form>";
?>
[code=php]
I want it to set the value to Yes for each record (identifed by the {$row['ID']}) for which I've checked the box.
Am I making sense? Can someone tell me how to do this?