Jump to content

Popup confirmation in PHP


tvks

Recommended Posts

Hi,

I have a small javascript code like this:

[code]<script language=javascript>
    function confirmSubmit(days) {
    var msg;
    msg= "Confirm for this leave application of "+id+" days";
    var agree=confirm(msg);
    if (agree)
    {
    }
    else
    {
    window.location = "http://abc.com/quick/long.php";
    }
    }
    </script>
    ?>
[/code]


My requirement is very simple. In the middle of my php program I need a confirm popup menu to come. If the user selects ok then the process should continue. If the user selects cancel the page must be redirected to long.php.

My problem is that, the place where the popup window is required is in an area in the form after the clicking of the submit button. hence I cannot use onclick. It is just in the middle of some calculations.

I would also be satisfied with any piece of code there in php for me to design something like the confirm function which does the same activity (without using Javascript).

I think "No" is an answer unknown to php.

Thanx for any help in advance.

Regards,

tvks
Link to comment
Share on other sites

no... php doesnt have the ability(that i know of) to forcevly stop in the middle of a script, the only way of doing it would be to split the script up into sections

[code]
switch($_GET[stage]){
default:
  #first stage, then header to stage 2
break;
case "stage2":
  yes|no
break;
case "no":
  redirect
break;
case "stage3":
  #continue
break;
}
[/code]
Link to comment
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.