Once again I bring my insignificant problems before the PHP gurus--only as a last resort of course.
Ok, so I have the following code:
<?php
#Choosing the correct database/establishing connection
$connection = mysql_connect("localhost", "XXXXX", "XXXX") or die("Death!");
$pickdatabase = mysql_select_db("ods1", $connection)
or die("Database Connection Problem!");
$_GET['delid'];
$_GET['dbtable'];
$_GET['idfield'];
$_GET['origin'];
$deleteform="<form align=\"Center\" action=\"$PHP_SELF\" method=\"post\">";
$deleteform.="<p>Are You Sure You Want To Delete This Record?</p>";
$deleteform.="<a href=\"$origin\">Back</a>";
$deleteform.="<input type=\"submit\" name=\"cdelete\" value=\"Confirm Delete\"></input>";
$deleteform.="</form>";
if($cdelete){
$delquery = "delete from $dbtable where $idfield='$delid'";
$runit=mysql_query($delquery, $connection) or die("Query failed");
echo("Record Deleted");
echo($deleteform);
}
else{
echo($deleteform);
}
?>
What I'm trying to do is create a generic delete function that can delete any field given to it from various other pages. Everything works fine except that when you click on the Confirm Delete Button in the form above, it says Query Failed. I don't get it. I can tell from the url that all the info is being sent correctly from the other pages.