Hi Folks,
Got a simple phonebook which I can add and update records too. Now I need to add in the function to allow me to delete a record.
I have my page which sows the details of the person, (details.php) and I want to be able to click a delete button on this page which re-directs to my deletedetails.php file which is below.
Can someone tell me why my record is not being deleted and what I'm doing wrong please?
(PS - all i did was take a copy of my updatedetails.php file and amend it, so maybe this is why it's not working??)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="phonebook.css" rel="stylesheet" type="text/css">
</head>
<?php
require "dbheader.inc";
$peopleid = $_GET['peopleid'];
if ($_POST["submit"]) {
$firstname = $_POST["firstname"];
$surname = $_POST["surname"];
$team = $_POST["team"];
$ext = $_POST["ext"];
$tel = $_POST["tel"];
$email = $_POST["email"];
$mobile = $_POST["mobile"];
$jobtitle = $_POST["jobtitle"];
$jobdescription = $_POST["jobdescription"];
$responsibleto = $_POST["responsibleto"];
if ($peopleid > 0) {
$SQLQuery1 = "DELETE FROM tblpeople WHERE id = $peopelid";
$Result = mysql_query($SQLQuery1);
}
?>
<body>
<table width="600" border="0" cellspacing="5" cellpadding="5">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="3"><p class="body">The details have now been deleted from the
database.<br>
<br>
Please choose an option from below:</p>
<p> </p>
<ul>
<li class="body"><a href="phonebook.php" target="_self">View the NCFE Phonebook</a></li>
<li><span class="body">Exit</span><br>
</li>
</ul></td>
</tr>
</table>
</body>
</html>