garyneedham7202 Posted March 6, 2012 Share Posted March 6, 2012 Hi Can anyone help with the following? I want to add a popup message to confirm the deleting of a record What code do I need to add to this <?php include_once ("includes/db.config.php"); mysql_query("DELETE FROM log WHERE id = '{$_GET['id']}' "); mysql_close(); // re-direct header("Location: log.php"); exit; ?> Quote Link to comment https://forums.phpfreaks.com/topic/258373-confirm-delete-of-a-record/ Share on other sites More sharing options...
scootstah Posted March 6, 2012 Share Posted March 6, 2012 You should be doing this from a POST request, not GET. Then you could tag an alert onto the form. Then do something like... <form action="" method="post" onsubmit="return confirm('Are you sure?');"> <input type="hidden" name="id" value="1" /> <input type="submit" name="submit" value="Delete" /> </form> Quote Link to comment https://forums.phpfreaks.com/topic/258373-confirm-delete-of-a-record/#findComment-1324436 Share on other sites More sharing options...
Adam Posted March 6, 2012 Share Posted March 6, 2012 I would add some sanitisation too if I were you! Quote Link to comment https://forums.phpfreaks.com/topic/258373-confirm-delete-of-a-record/#findComment-1324478 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.