ali_2kool2002 Posted March 25, 2007 Share Posted March 25, 2007 Hi im really stuck, can have an alert before i delete something. For example, if someone can code this i can adjust it to mine, basically, i have say 2 radio buttons, depending on which radio button is pressed i want to have an alert saying "are you sure you want to delete?" then with the option ok or cancel, ok would trigger a query in the databse, and cancel with return back via header...? hope someone can help :-\ :-\ Quote Link to comment https://forums.phpfreaks.com/topic/44234-solved-confirmation-alerts/ Share on other sites More sharing options...
cmgmyr Posted March 25, 2007 Share Posted March 25, 2007 delete.php where you would put the page you are confirming to go to <a href="delete.php" onclick="return confirm('Are you sure you want to delete this?')">Delete</a> Quote Link to comment https://forums.phpfreaks.com/topic/44234-solved-confirmation-alerts/#findComment-214826 Share on other sites More sharing options...
ali_2kool2002 Posted March 25, 2007 Author Share Posted March 25, 2007 but i need to pass a value from the link ? how is this done as the radio button can pass a value to the delet.php page... Quote Link to comment https://forums.phpfreaks.com/topic/44234-solved-confirmation-alerts/#findComment-214841 Share on other sites More sharing options...
cmgmyr Posted March 25, 2007 Share Posted March 25, 2007 You can pass a value like this. <a href="delete.php?value=<?php echo $value ?>" onclick="return confirm('Are you sure you want to delete this?')"> Quote Link to comment https://forums.phpfreaks.com/topic/44234-solved-confirmation-alerts/#findComment-214845 Share on other sites More sharing options...
ali_2kool2002 Posted March 25, 2007 Author Share Posted March 25, 2007 <?php require_once('../../mysql_connect.php'); $did = $_GET['catId'] ; echo "<b>Deleted catId :</b> $did <br>"; $query_delete_category = "DELETE FROM category WHERE catId='$did'"; $get_cat_res = mysql_query($query_delete_category) or die(mysql_error()); ?> THIS IS THE WAY TO GET THE ID FROM THE URL IN DELETE.Php WHEN THE POSTed solution FROM CMGMYR IS PUT INTO ANOTHER PAGE CHEERS MATE ,,, WAS HARD WORK BUT WORTH IT !! Quote Link to comment https://forums.phpfreaks.com/topic/44234-solved-confirmation-alerts/#findComment-214942 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.