Sorry to post such a simple thing to many, but having spend much of the day on this unsuccessfully I'm stumped.
In short, using a form that passes and ID to the script I simply wish it to delete the record ID sent.
You will see a line in the script "print $id;". I simply added that to see if $id would print to verify that it contained the id entered in the form, which it did and does. Why won't this script delete the entered id from the database!!!! Help
<?PHP
$username="username";
$password="password";
$database="database";
print "<form method='POST' action='deletetest.php'>";
print "<pre>";
print "Enter Id Number to Edit: <input type='text' id='id' name='id' size='5'>";
print "<input type='submit' value='Submit'>";
print "</pre>";
print "</form>";
$id = $_POST['id'];
$con = mysql_connect(localhost,$username,$password);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("$database", $con);
mysql_query('DELETE FROM inst_order WHERE id='$id');
print $id;
mysql_close($con);
?>
In short, using a form that passes and ID to the script I simply wish it to delete the record ID sent.
You will see a line in the script "print $id;". I simply added that to see if $id would print to verify that it contained the id entered in the form, which it did and does. Why won't this script delete the entered id from the database!!!! Help
<?PHP
$username="username";
$password="password";
$database="database";
print "<form method='POST' action='deletetest.php'>";
print "<pre>";
print "Enter Id Number to Edit: <input type='text' id='id' name='id' size='5'>";
print "<input type='submit' value='Submit'>";
print "</pre>";
print "</form>";
$id = $_POST['id'];
$con = mysql_connect(localhost,$username,$password);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("$database", $con);
mysql_query('DELETE FROM inst_order WHERE id='$id');
print $id;
mysql_close($con);
?>