I have specified what I need to do in a Function that takes the table name.. Actually I am using phpUpdate() and phpInsert().. However I am not sure how to execute the fuction after my FORM has been updated.
This is what I have so far.. but I am also trying to update the form with current values.
any help is appreciated..
-Riddler
if ($REQUEST_METHOD == 'POST')
{
if ($submit)
{
echo "<center><FONT SIZE=5><b>Update DVD</b></FONT>\n";
echo "<form action=\" $PHP_SELF \" enctype=\"multipart/form-data\" method=POST>\n";
echo "<table width=\"100%\" border=0 cellpadding=0>\n";
echo "<tr>\n";
echo "<th align=right>Title: </th><td><input type=text value=" $Title " name=FORM_Title size=30 tabindex=0></td>\n";
echo "<td colspan=2 align=right><select name=Genre>\n";
echo " <option selected name=FORM_genre value=" $Genre "> "$Genre" </option>\n";
$Genre = mysql_query("select distinct Genre from dvds");
while($row = mysql_fetch_row($Genre)) {
echo " <option>".stripslashes($row[0])."</option>\n";
}
mysql_free_result($Genre);
echo "</select></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<th align=right>Who Checked it out: </th>\n";
echo "<td><input type=text name=FORM_By_who size=30 value=" $By_who " tabindex=1></td>\n";
echo "<td colspan=2 align=right><input type=text name=newgenre value=\"Enter new Genre\" size=15 tabindex=\"6\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<th align=right>Checked Out:</th>\n";
echo "<td align=left><input type=checkbox name=FORM_Checked_out value=" $Checked_out " tabindex=\"3\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<th align=right>Stacy needs to see this: </th>\n";
echo "<td align=left><input type=checkbox name=FORM_Stacy_needs_to_see value=" $Stacy_needs_to_see " tabindex=2></td>\n";
echo "<td align=left><input type=hidden name=FORM_ID value=" $ID "</td>\n";
echo "<td colspan=2 align=center><input type=\"submit\" value=\" Update a DVD \"></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</form>\n";
echo "</center>\n";
phpUpdate(dvds.dvds);
}
}
else
{
echo "<center><FONT SIZE=5><b>Update DVD</b></FONT>\n";
echo "<form action=\"" $PHP_SELF "\" enctype=\"multipart/form-data\" method=POST>\n";
echo "<table width="100%" border=0 cellpadding=0>\n";
echo "<tr>\n";
echo "<th align=right>Title: </th><td><input type=text value=" $Title " name=FORM_Title size=30 tabindex=0></td>\n";
echo "<td colspan=2 align=right><select name=Genre>\n";
echo " <option selected name=FORM_genre value=" $Genre "> "$Genre" </option>\n";
$Genre = mysql_query("select distinct Genre from dvds");
while($row = mysql_fetch_row($Genre)) {
echo " <option>".stripslashes($row[0])."</option>\n";
}
mysql_free_result($Genre);
echo "</select></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<th align=right>Who Checked it out: </th>\n";
echo "<td><input type=text name=FORM_By_who size=30 value=" $By_who " tabindex=1></td>\n";
echo "<td colspan=2 align=right><input type=text name=newgenre value=\"Enter new Genre\" size=15 tabindex=\"6\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<th align=right>Checked Out:</th>\n";
echo "<td align=left><input type=checkbox name=FORM_Checked_out value=" $Checked_out " tabindex=\"3\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<th align=right>Stacy needs to see this: </th>\n";
echo "<td align=left><input type=checkbox name=FORM_Stacy_needs_to_see value=" $Stacy_needs_to_see " tabindex=2></td>\n";
echo "<td align=left><input type=hidden name=FORM_ID value=" $ID "</td>\n";
echo "<td colspan=2 align=center><input type=\"submit\" value=\" Update a DVD \"></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</form>\n";
echo "</center>\n";
}