Add the following to the section of the page:
<script language="javascript" type="text/javascript">
function verifyDelete(page) {
if (confirm("Are you sure you want to delete this report?")) {
location.href=page;
} else {
return false;
}
}
</script>
To call the function within the page itself, add the following to a link, button, or image:
<a href="javascript:verifyDelete('page_that_does_the_delete.php?key=#')">
delete</a>
Now, when the visitor clicks on the delete, a pop-up windows comes up and prompts asking if they are sure they want to delete the information. If they click on Cancel, then it just closes the pop-up and nothing happens. If they click on OK, then the delete program is called and the record is deleted.
No comments:
Post a Comment