Original Form
<?php
echo '<td><form action="episodesdelete.php" method="POST">';
echo '<input type="hidden" name="epid" value="'.$row['epid'].'">';
?>
episodesdelete.php
<?php
$connection = mysql_connect("localhost","root","")
or die ("Couldn't Connect To Server");
$db = mysql_select_db("shows", $connection)
or die ("Couldn't Select Database");
$query = "DELETE FROM shows WHERE epid= "'.$_POST['epid']'";
$result = mysql_query($query)
or die ("Query Failed: " . mysql_error());
?>
First of all, you have in-correct usage of double quotes:
Should be:
You have one more problem:
You also need to use
$_POSTarray with correct field name like:Because you are using
POSTas method of the form:You need to use
$_POSTAnd because your hidden field is named
id:You need to specify that in your query:
So here is how your query should be: