saeed_violinist Posted June 3, 2009 Share Posted June 3, 2009 Dear friends, I want to know how to ask user if they really want to do a simple task like deleting a member from database. I made a link like "manage.php?action=delete?id=2", ofcourse by clicking on this link user with id=2 will be deleted from the database. but how to ask from user if they really want to delete or not? I know there is a method to confrim FORM submission, but I dont want to convert every link like that to a form. Thanks. Quote Link to comment Share on other sites More sharing options...
jxrd Posted June 3, 2009 Share Posted June 3, 2009 You could so something like this: if(!isset($_GET['confirmed'])) { echo 'Do you really want to delete this?<br /><a href="'.$_SERVER['REQUEST_URI'].'&confirmed=true">yes</a>'; } else { //delete.... } This is just an example - it'd be more secure to do with the POST method and a form, but you get the idea... Quote Link to comment Share on other sites More sharing options...
Axeia Posted June 3, 2009 Share Posted June 3, 2009 http://www.tizag.com/javascriptT/javascriptconfirm.php Just ommit the else part. Quote Link to comment Share on other sites More sharing options...
saeed_violinist Posted June 3, 2009 Author Share Posted June 3, 2009 The problem is I want to use it inside a php for loop, so for every loop it should go to a specific page (I rather say the ?id=2 will be ?id=1 too ?id=999 or the last row). it cant be done like that tutorial . Quote Link to comment 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.