I'm currently working on a part of my project that requires user input at a certain point. I simply need them to confirm or cancel a request. In order to handle this, I wrote it as a two part script.
The main php script uses an echo statement to set up a form like this:
$return="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$dialog="This serial number it tied to an invoice number. Are you certain you want to do this?";
$Yes=$return."&Delete_Shipped=Yes";
$No=$return."&Delete_Shipped=No";
echo " <form method='post' action='/php/Confirm.html'>
<input type='hidden' name='Dialog' value='$dialog'>
<input type='hidden' name='Yes' value='$Yes'>
<input type='hidden' name='No' value='$No'>
<input type='submit' value='Press Here to Continue'>
</form>
";
The second part, simply creates a Javascript Confirm box and sends the information:
<body>
<?php
$Dialog=$POST['Dialog'];
$Yes=$POST['Yes'];
$No=$_POST['No'];
echo "
<script>
<!--
var YesNo = confirm('$Dialog');
if (YesNo == true)
{
window.location='$Yes';
}
else
{
window.location='$No';
}
-->
</script>
";
?>
Which will, in turn, send the information back to the calling program.
My problem is that my users must click on a button to continue, which then takes them to a confirm dialog box to choose between OK and Cancel. Is there any way to avoid this clunky way of getting user interaction? I've tried to find something about dialog/message boxes within PHP, but have been unable to do so. Any help would be greatly appreciated...