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
https://forums.phpfreaks.com/topic/31221-popup-confirmation-in-php/
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]

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.