Zeradin Posted September 8, 2008 Share Posted September 8, 2008 I don't know if this counts as a php question or an sql question or a javascript question but I'm trying to make a "are you sure" alert box for deleting things. like this: <SCRIPT LANGUAGE="javascript"> <!-- function CONFIRM(){if (!confirm ("Are you sure you want to delete?")) history.go(-1);return " "} document.writeln(CONFIRM()) <!-- END --> </SCRIPT> <?php // create show query $dquery = 'delete FROM pms WHERE id = '.$mid.''; // execute show query $dresult = mysql_query($dquery) or die ("Error in query: $dquery. ".mysql_error()); but if you say cancel it goes back to the last page but still deletes the entry. how can i fix this? i tried adding a <?php die; ?> but it didn't work either. Help? Link to comment https://forums.phpfreaks.com/topic/123313-solved-quotare-you-surequot/ Share on other sites More sharing options...
BlueSkyIS Posted September 8, 2008 Share Posted September 8, 2008 example: <form method='post' action='something.php' onclick='return confirm("Are you sure you want to delete?");'> Link to comment https://forums.phpfreaks.com/topic/123313-solved-quotare-you-surequot/#findComment-636859 Share on other sites More sharing options...
Zeradin Posted September 8, 2008 Author Share Posted September 8, 2008 can i integrate that into a link? or a button? or do i put that on the delete page? Link to comment https://forums.phpfreaks.com/topic/123313-solved-quotare-you-surequot/#findComment-636861 Share on other sites More sharing options...
discomatt Posted September 8, 2008 Share Posted September 8, 2008 You can put it on any element that support the onclick attribute... so yes, anchors and inputs can have them. Link to comment https://forums.phpfreaks.com/topic/123313-solved-quotare-you-surequot/#findComment-636884 Share on other sites More sharing options...
Zeradin Posted September 8, 2008 Author Share Posted September 8, 2008 awesome. got it to work and everything thanks guys! Link to comment https://forums.phpfreaks.com/topic/123313-solved-quotare-you-surequot/#findComment-636900 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.