使用php删除数据库中的行

I want to delete a row in a database that I have added but when i try to click the delete button in my index.php it says record deleted but when I click ok, it does not delete the record, here are my codes:

index.php:

$con = mysql_connect("localhost","pma");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("class_schedule", $con);

$result = mysql_query("SELECT * FROM schedule");

?>
<center>
<table border="1" width="800">
<tr>
<td colspan='8'><input type="text" width='300'/>
<input type="button" value="Search" onclick="location='search.php'" />
<input type="button" value="View All" onclick="window.location.href=''"/>
<input type="button" value="Add" onclick="location='add.php'"/></td>
</tr></table>

<?php
echo "<center><table border='1' width='800'>
<tr>
    <td><center>Time</td>
        <td><center>Subject</td>
    <td><center>Course</td>
    <td><center>Section</td>
        <td><center>Day</td>
    <td><center>Room</td>

</tr>";

while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['time'] . "</td>";
echo "<td>" . $row['subject'] . "</td>";
echo "<td>" . $row['course'] . "</td>";
echo "<td>" . $row['section'] . "</td>";
echo "<td>" . $row['day'] . "</td>";
echo "<td>" . $row['room'] . "</td>";

?>


<td><input type="submit" value="Edit" name="edit" />
<form action="delete.php" method="post">
<input type="submit" value="Delete" name="delete" onclick="location='delete.php'" />
</td>
</form>
<?php
echo "</tr>";
}
echo "</table></center>";

mysql_close($con);
?>

And this is my delete.php:

<?php

    require "connect.php";
    $deltime=$_POST["deltime"];
    mysql_query("DELETE FROM schedule WHERE deltime='$deltime'");
    mysql_close($con);
?>
<div>
<p align="center"><b>Record Deleted</b><br/>
<form method="post">
    <center><input type="submit" name="submit" value="Ok" formaction="index.php" /></center>
</form>
</p></div></form>

What am I missing, and what should I remove and add?

Modify the following line

mysql_query("DELETE FROM schedule WHERE deltime='$deltime'");

As

mysql_query("DELETE FROM schedule WHERE deltime='$deltime'", $con);

your id was not getting in delete.php file so just remove your delete button and replace with this code:

<td><a href="delete.php? id=<?php echo $row['id'];?>">Delete</td>

Try to send the date through one link to the delete.php

<td><a href = 'delete.php'?date=<?php echo $row['time'];?>>DELETE</a></td>