I have this delete statement that is meant to delete a row of data in a mysql table depending on the email that the users enters into the text field.
The query seems to go through with no errors but the data remains. I have a INSERT query with the same table and that is working perfectly.
My code:
<?php
require ("database.php");
if($_POST['action'])
{
$email =$_GET['Email'];
// sending query
mysql_query("DELETE FROM List WHERE Email = '$email'")
or die(mysql_error());
header("Location: admin.php");
}
?>
<center><form action="" method="post">
<h1> Delete Email </h1>
<br>
Email:<br><input type="text" name="Email" required placeholder="@alpinemotors.co.za"
pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$" title="Must be a valid email address, eg: user@mail.co.za">
<br/>
<br><h2><input type="submit" name="action" value="Delete Email">
<br></h2>
<h3>
<a href="admin.php"> Main Menu </a>
</h3>
</form>
</center>