adriscoll Posted April 30, 2011 Share Posted April 30, 2011 Hello. How can I insert a prompt to confirm the deletion of a record? Currently I have a page that lists all of the table entries with a url to pass along the variable to identify the record to delete on a hidden, secondary page. Page 1 echo "<a href=\"/administrator/db/event_delete2.php?id=$row[id]\">Delete</a>"; Page 2 mysql_query("DELETE FROM event_schedule WHERE id='$id' LIMIT 1"); The code may be sloppy, but it works. Now I am trying to add the speedbump of the "are you sure you want to delete this record?" Thank you. Link to comment https://forums.phpfreaks.com/topic/235144-confirm-delete-on-submit/ Share on other sites More sharing options...
gizmola Posted April 30, 2011 Share Posted April 30, 2011 You'll need to code up a javascript function that implements your confirmation. Here's one that uses the built-in javascript confirm() dialog. function confirmBox(msg, target) { if (confirm(msg)) { window.location=target; } } And you'd use it like so: click Me Link to comment https://forums.phpfreaks.com/topic/235144-confirm-delete-on-submit/#findComment-1208470 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.