Delete from form
Posted: Tue Jul 13, 2010 1:29 am
Hi everyone,
I am sure this is a simple question for most, but I am almost burnt-out.
(I was doing good to get my login and sessions for each page dome by myself)
My problem is deleting a record from a table.
Here are both of the codes I am using:
html code for the form:
php code to delete file:
It acts as if it wants to work, as I do not get any errors. I am missing something simple I am sure.
I am sure this is a simple question for most, but I am almost burnt-out.
(I was doing good to get my login and sessions for each page dome by myself)
My problem is deleting a record from a table.
Here are both of the codes I am using:
html code for the form:
Code: Select all
<form action="completedelete.php" method="post" enctype="application/x-www-form-urlencoded">
Id Number:
<input type ="text" name="userID" size="4" tabindex="3" style="background-color:#CCCCCC" />
<INPUT TYPE="submit" VALUE="Delete Contact">
</FORM>
php code to delete file:
Code: Select all
<?php
$con = mysql_connect("localhost","user2","password2");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("gatlin", $con);
$id= 'userID';
mysql_query("DELETE FROM contacts WHERE userID='$id'");
mysql_close($con);
?>