SoulAssassin Posted June 7, 2007 Share Posted June 7, 2007 I have a form button that I would like to have a confirmation pop up before submit like this: <input name="delivered_id" type="hidden" value="id21" /> <input type="button" name="deliverconf" value="Deliver" onclick="temp = window.confirm('Confirm Delivery?');"> The confirm message with Ok and Cancel pops up, but it seems like my temp" variable gets set. Then I have do this, with no success: <? if(isset($_POST['deliverconf'])) { $self = $_SERVER['php_self']; $delivered_id = $_POST['delivered_id']; $deliverconf = $_POST['deliverconf']; echo "$delivered_id"; echo "$deliverconf"; } ?> This "if(isset($_POST['deliverconf']))" doesn't even happen. I also tried "if(isset($_POST['temp']))", but nothing. Why can that be? I also thought it might work like this: <? if ($temp) { echo "$temp"; } ?> Also no success, and even if it does, will I loose my POST values. Any suggestions, or a better method to get a confirmation message? Link to comment https://forums.phpfreaks.com/topic/54569-onclick-confirm/ Share on other sites More sharing options...
SoulAssassin Posted June 7, 2007 Author Share Posted June 7, 2007 Ok, I have played with it, tried this: <input type="button" name="deliverconf" value="Deliver" onclick="return confirm('Confirm Delivery?');"> <? if(isset($_POST['deliverconf'])) { echo "Form Sumitted"; } ?> and it still doesn't work. Please guys, doesn't anyone have a suggestion? Link to comment https://forums.phpfreaks.com/topic/54569-onclick-confirm/#findComment-269916 Share on other sites More sharing options...
SoulAssassin Posted June 7, 2007 Author Share Posted June 7, 2007 Should I not maybe put the something in the <form>? <form action="" method="post" onSubmit="return confirm('Confirm Delivery?');"> Link to comment https://forums.phpfreaks.com/topic/54569-onclick-confirm/#findComment-269928 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.