ok pretty simple stuff here.... maybe ive been staring at this screen too long and im going crazy, but here is the problem
i have a form that gets passed information.... the form has two buttons, one for "edit" and one for "delete".... the edit works perfectly
when the user hits delete he is taken to a page where it displays the record that he is wanting to delete and asks the user to confirm the delete action, by hitting the "yes" button.... at this point the confirm_delete_admin form jumps to a page that deletes the record.... and its on this page im having a problem
i am getting an "Undefined index: delete_record in c:\inetpub\wwwroot\confirm_delete_admin.php on line 15" error.... now all this is, is the $houseID data getting passed from the confirm_delete_admin form on the last page.... this is EXACTLY how i have passed information with every other form ive used so i dont see why its not working in this instance... any help would be appreciated, thx
here is the code for the first page where the person selects yes or no for the delete prompt:
if (isset($_POST["delete"]))
{
echo "<form action='confirm_delete_admin.php' method='post'>";
echo "<table cellpadding='1' border='1'>";
echo "<td valign='top' width='5%'><b>ID</b></td><td valign='top' width='15%'><b>Name</b></td>
<td valign='top' width='15%'><b>Address</b></td><td valign='top' width='10%'><b>City</b></td>
<td valign='top' width='5%'><b>Province</b></td><td valign='top' width='8%'><b>Postal Code</b></td>
<td valign='top' width='10%'><b>Phone Number</b></td><td valign='top' width='10%'><b>Alt. Phone Number</b></td>
<td valign='top' width='20%'><b>Description</b></td><td valign='top' width='10%'><b>Grouping</b></td>";
while($row = mysql_fetch_array($result,MYSQL_ASSOC))
{
extract($row);
echo "<tr><td valign='top' width='5%'>\n";
echo "<name='delete_record' value='$houseID'\n";
echo ">$houseID</td>";
echo "<td valign='top' width='15%'>$name</td>
<td valign='top' width='15%'>$address</td><td valign='top' width='10%'>$city</td>
<td valign='top' width='5%'>$province</td><td valign='top' width='8%'>$postalCode</td>
<td valign='top' width='10%'>$phoneNum</td><td valign='top' width='10%'>$altPhoneNum</td>
<td valign='top' width='20%'>$description</td><td valign='top' width='10%'>$grouping</td>";
echo "</tr>";
}
echo "</table>";
echo "<b>Are you sure you want to delete the above record?</b>.<br>";
echo "<input type='submit' name='yes' value='Yes'><input type='submit' name='no' value='No'>";
echo "</form>";
}
and here is the code from the confirm_delete_admin page that hitting the yes button will bring up:
<?php
include("other.inc");
include("accesscontrol2.php");
if (isset($_POST["no"]))
header("Location: admin.php"); //jumps user back to admin start if they dont want to delete record
if (isset($_POST["yes"]))
{
echo "<h3>Admin Control</h3>";
$connection = mysql_connect($host,$user,$password)or die ("couldn’t connect to server");
$db = mysql_select_db($database,$connection)or die ("Couldn’t select database");
$query = "SELECT * FROM houses WHERE houseID =\"{$_POST['delete_record']}\"";
$result = mysql_query($query) or die ("Couldn’t execute query.");
echo "<table cellpadding='1' border='1'>";
echo "<td valign='top' width='5%'><b>ID</b></td><td valign='top' width='15%'><b>Name</b></td>
<td valign='top' width='15%'><b>Address</b></td><td valign='top' width='10%'><b>City</b></td>
<td valign='top' width='5%'><b>Province</b></td><td valign='top' width='8%'><b>Postal Code</b></td>
<td valign='top' width='10%'><b>Phone Number</b></td><td valign='top' width='10%'><b>Alt. Phone Number</b></td>
<td valign='top' width='20%'><b>Description</b></td><td valign='top' width='10%'><b>Grouping</b></td>";
while($row = mysql_fetch_array($result,MYSQL_ASSOC))
{
extract($row);
echo "<tr><td valign='top' width='5%'>\n";
echo "<name='edit_record' value='$houseID'\n";
echo ">$houseID</td>";
echo "<td valign='top' width='15%'>$name</td>
<td valign='top' width='15%'>$address</td><td valign='top' width='10%'>$city</td>
<td valign='top' width='5%'>$province</td><td valign='top' width='8%'>$postalCode</td>
<td valign='top' width='10%'>$phoneNum</td><td valign='top' width='10%'>$altPhoneNum</td>
<td valign='top' width='20%'>$description</td><td valign='top' width='10%'>$grouping</td>";
echo "</tr>";
}
echo "</table>";
$delete_record = "delete from houses where houseID = $houseID";
$result_delete = mysql_query($delete_record) or die ("Couldnt execute delete.");
echo "<b>The above record was deleted.</b>.<br>";
echo "<a href=admin.php>Search for more records.</a>";
}
?>
i just cant figure out why this isnt working, it worked fine on every other page ive used it on