This is driving me nuts. I need to update "live" for each "id" depending on whether it has been checked ("1") or not ("0").
This is the basic code I have so far. What do I need to do in the reponse page ("two.php") to make this work?
Please help. TIA.
<><><><><>
one.php:
<><><><><>
echo "<form action=\"two.php\" method=\"post\">";
while ($qd = mysql_fetch_array ($result))
{
echo "<input type=\"checkbox\" id=\"$qd[id]\" name=\"live[]\"";
if ($qd[live] == "1") // IF THE CHECKBOX IS CHECKED
{
echo " value=\"$qd[live]\" checked=\"checked\">";
}
elseif ($qd[live] == "0") // IF THE CHECKBOX IS NOT CHECKED
{
echo " value=\"$qd[live]\">";
}
echo "<p> $qd[brewery] </p>";
echo "<p align=\"center\">$qd[sponsor]</p>";
}
echo "<input type=\"submit\" name=\"submit\" value=\"Update\"> ";
echo "<input type=\"reset\">";
echo "</form>";
<><><><><>
two.php:
<><><><><>
if ($submit == "Update")
{
$query = "update brewers set live = '$live' where id = '$id'";
mysql_query ($query) or die (mysql_error());
echo "<p>The brewery list for has been updated.</p>";
echo "<p><a href=\"index.php\">Return</a> to the main <b>BREWERS</b> page or<br>choose another section from the menu at the top of this page.</p>";
}
<><><><><>