this should be the easiest thing in the world to do but i have no clue what i'm missing. think i've got friday afternoon blues.
basically, have table "courses". in it there's an "enabled / disabled" fields.
there's a table that shows all the records and outputs whether the row is enabled or disabled. if enabled, there's a button to disable, and vice versa.
up to here its fine. lets say i have two records: record 5 and 6.
for some reason when i hit enable for row 5, it enables row 6. WTF?
this is the code that does the actual modification.
no errors. if i enable row 6 it works fine. if i enable row 5, it enables row 6. what am i missing!
basically, have table "courses". in it there's an "enabled / disabled" fields.
there's a table that shows all the records and outputs whether the row is enabled or disabled. if enabled, there's a button to disable, and vice versa.
if ($row_course[enabled]=="yes")
{
print ("Enabled<br>"); ?>
<form method = post action = editcourses.php>
<input type = hidden name = id value = <? echo $row_course[id] ?>>
<input type = submit name = disableit value = "Disable">
<form> <?
}
else
{
print ("Disabled<br>"); ?>
<form method = post action = editcourses.php>
<input type = hidden name = id value = <? echo $row_course[id] ?>>
<input type = submit name = enableit value = "Enable">
<form> <?
}
up to here its fine. lets say i have two records: record 5 and 6.
for some reason when i hit enable for row 5, it enables row 6. WTF?
this is the code that does the actual modification.
if (isset($_POST[enableit])) {
print ("enabling $_POST[id]");
mysql_query("UPDATE courses SET enabled='yes' WHERE ID='$_POST[id]'") or die(mysql_error());
}
if (isset($_POST[disableit])) {
print ("disabling $_POST[id]");
mysql_query("UPDATE courses SET enabled='no' WHERE ID='$_POST[id]'") or die (mysql_error());
}
no errors. if i enable row 6 it works fine. if i enable row 5, it enables row 6. what am i missing!