Jump to content

onclick confirm


SoulAssassin

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.