kyleldi Posted August 17, 2007 Share Posted August 17, 2007 Is there a way in php to create a confirmation box when a user does something like delete a row from a database? I'm trying to get away w/o using javascript to pull this off, but I don't know if it's possible. Right now I've just got it set up to delete when the link is clicked, but I don't find that to be a safe enough practice considering how easy it would be to screw up. Any help would be appreciated. Thanks, Kyle Quote Link to comment https://forums.phpfreaks.com/topic/65409-solved-php-delete-confirmation-message/ Share on other sites More sharing options...
gerkintrigg Posted August 17, 2007 Share Posted August 17, 2007 $query="SELECT * FROM table"; if(mysql_query($query){ echo 'notification message goes here'; } That should work ;o) Quote Link to comment https://forums.phpfreaks.com/topic/65409-solved-php-delete-confirmation-message/#findComment-326631 Share on other sites More sharing options...
kyleldi Posted August 17, 2007 Author Share Posted August 17, 2007 Works great of course What I was hoping for was some sort of popup window (something small)- is this possible in php? Sorry I wasn't very specific last time. Quote Link to comment https://forums.phpfreaks.com/topic/65409-solved-php-delete-confirmation-message/#findComment-326636 Share on other sites More sharing options...
cmgmyr Posted August 17, 2007 Share Posted August 17, 2007 The easiest way to do this is with a JS pop up, you might be able to do it with a DHTML window...but i'm not sure Quote Link to comment https://forums.phpfreaks.com/topic/65409-solved-php-delete-confirmation-message/#findComment-326669 Share on other sites More sharing options...
MadTechie Posted August 17, 2007 Share Posted August 17, 2007 gerkintrigg & cmgmyr in one $query="SELECT * FROM table"; if(mysql_query($query){ echo '<script language="javascript">alert("notification message goes here");</script>'; } for confirm (example i found) <html> <head> <script type="text/javascript"> <!-- function confirmation() { var answer = confirm("Leave tizag.com?") if (answer){ alert("Bye bye!") window.location = "http://www.google.com/"; } else{ alert("Thanks for sticking around!") } } //--> </script> </head> <body> <form> <input type="button" onclick="confirmation()" value="Leave Tizag.com"> </form> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/65409-solved-php-delete-confirmation-message/#findComment-326671 Share on other sites More sharing options...
kyleldi Posted August 17, 2007 Author Share Posted August 17, 2007 You guys rock. Quote Link to comment https://forums.phpfreaks.com/topic/65409-solved-php-delete-confirmation-message/#findComment-326689 Share on other sites More sharing options...
cmgmyr Posted August 17, 2007 Share Posted August 17, 2007 You can also do: <a href="delete.php?id=<?php echo $id ?>" onclick="return confirm('Are you sure you want to delete this?')">DELETE</a> Quote Link to comment https://forums.phpfreaks.com/topic/65409-solved-php-delete-confirmation-message/#findComment-326701 Share on other sites More sharing options...
MadTechie Posted August 17, 2007 Share Posted August 17, 2007 very true.. much better Quote Link to comment https://forums.phpfreaks.com/topic/65409-solved-php-delete-confirmation-message/#findComment-326705 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.