Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.