theres nothing happen everytime i click delete.
here's my code
admin.php
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("reservation", $con);
$result = mysql_query("SELECT * FROM guest order by code asc");
mysql_close($con);
<script>
del=function(code){
m = confirm("Are you sure you want to delete this Applicants?");
if(m){
document.location="deleteApplication.php?id=<?php echo $_GET['code']; ?>";
}
}
grant=function(code){
m = confirm("Are you sure you want to Grant this Applicants?");
if(m){
document.location="grantApplication.php?id="+code+"&page=<?php echo $_GET['code']; ?>";
}
}
</script>
<table border='1' cellspacing='0' width='613'>
<tr>
<th bgcolor='green'><font color='white'>Customer Code</font></th>
<th bgcolor='green'><font color='white'>First Name</font></th>
<th bgcolor='green'><font color='white'>Middle Name</font></th>
<th bgcolor='green'><font color='white'>Last Name</font></th>
<th bgcolor='green'><font color='white'>Address</font></th>
<th bgcolor='green'><font color='white'>Email Adress</font></th>
<th bgcolor='green'><font color='white'>Contact No</font></th>
<th bgcolor='green'><font color='white'>Remove</font></th>
</tr>
<?php
$i = 0;
$number = 0;
while($row = mysql_fetch_array($result)){
$number++;
?>
<?php
$i++;
if($i%2)
{
$bg_color = "#EEEEEE";
}
else {
$bg_color = "#E0E0E0";
}
?>
<tr bgcolor='". $bg_color ."'>
<td><font color='red'><?php echo $row['code']; ?></font></td>
<td><?php echo $row['fname']; ?></td>
<td><?php echo $row['mname']; ?></td>
<td><?php echo $row['lname']; ?></td>
<td><?php echo $row['address']; ?></td>
<td><?php echo $row['emailadd']; ?></td>
<td><?php echo $row['contactno']; ?></td>
<td><a href='javascript:del(<?php echo $row['cno']; ?>);void(0); '><font color="blue">Delete</font></a></td>
</tr>
<?php } ?>
</table>
?>
deleteApplication.php
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("reservation", $con);
$result = mysql_query("SELECT * FROM guest order by code asc");
if (isset($_GET['code']) && is_numeric($_GET['code']))
{
// get id value
$code = $_GET['code'];
// delete the entry
$result = mysql_query("DELETE FROM guest WHERE code=$code")
or die(mysql_error());
// redirect back to the view page
header("Location: admin.php");
}
else
// if id isn't set, or isn't valid, redirect back to view page
{
header("Location: admin.php");
}
?>
after clicking delete theres ma message box prompt "Are you sure u want to delete this application?" Yes or No, if i click yes there's nothing happen. i want to delete the row where i select the delete button help please.