hi,
I have two php file:
1. list.php
2. delete.php
On the list.php, there is a link word delete which refer to the delete.php and also send the id of the current record to the delete.php.
On the delete.php I have the following code:
<body>
<?php
//must ask for confirmation, now it not check it...
if(isset($_GET['studentCode']))
{
$getCode = $_GET['studentCode'];
?>
<script language="javascript">
var del = window.confirm('Are you sure deleting the selected record?');
if(del==true)
{
<?php
include ("../database.php");
connect();
doCommand("DELETE FROM tblstudent WHERE stCode=$getCode");
disConnect();
print(reDirect("list.php"));
?>
}
else
{
alert('Canceled Deletion');
<?php
print(reDirect("list.php"));
?>
}
</script>
<?php
}
?>
</body>
it deletes the seleced record which came from list, and the confirmation not appears...
PROBLEM:
I want the confirmation message appears before deleting the selected record, if yes, then delete, if no, then go back to list.php