Hi guys.
I have the following setup:
PAGE 1 (addmenu4entry.php) --------------------------
--> PAGE 2 (processmenu4entry.php)
==========================
==========
==========
==========
== addmenu4entry.php
<form action="processmenu4entry.
php" method="post" style="margin-top:0%;">
<label style="color:white;">Type your term here to add a new entry: </label>
<input type="text" name="newmenu4entry" size="30" />
<input type="submit" name="submitword" value="SUBMIT" />
</form>
==========================
==========
==========
==========
=== processmenu4entry.php
In here, I retrieve the value of the posted variable 'newmenu4entry' from
addmenu4entry.php as follows...
if ($set_status == 1) {
$menu4_entry = $_POST['newmenu4entry'];
So I now have the value of $menu4_entry in processmenu4entry.php
##########################
##########
#####
WHAT I WANT TO DO IN processmenu4entry.php
##########################
##########
#####
a) After I have got the value of newmenu4entry through using
$menu4_entry = $_POST['newmenu4entry'];
I want to set up a confirm box requesting the user to either click on 'OK' to proceed,
or 'Cancel' to discontinue running the processmenu4entry.php script.
b) So, currently i put the following javascript function into my page:
This basically says "If you clicked on ok, then point to the same page im in, and set the parameter continue to 1, otherwise you clicked cancel, so set continue to be 0
==========================
==========
==========
==========
==========
==
<script type="text/javascript">
function confirmation() {
if (confirm("Do you wish to proceed?")){
document.location.href = "processmenu4entry.php?con
tinue=1";
} else {
document.location.href = "processmenu4entry.php?con
tinue=0";
}
}
</script>
==========================
==========
==========
==========
==========
=
Now, after I have returned the value for
$menu4_entry = $_POST['newmenu4entry'];
I then called the confirmation function with:
==========================
======== the below presents the user with the confirm box:
if (!isset($_GET['continue'])
) { ?>
<script type="text/javascript">con
firmation(
); </script> <?php
========================= if the user has already clicked on cancel, or ok, then the else follows..
1) which gets the value of continue from the query string
2) then checks the value of continue...
else {
$continue = $_GET['continue'];
if ($continue) { do this
else { do that }
########################
PROBLEM:
########################
I need access to the value of the $menu4_entry inside of:
else {
$continue = $_GET['continue'];
if ($continue) { do this ------> this is where i need access to the value of $menu4_entry
else { do that ---------> also here }
Because this if else is looking at the value of the continue parameter in the querystring submitted by the javascript function confirmation, it seems im losing access to the value of $menu4_entry inside this code, so im wondering how to get access to thie $menu4_entry inside this code area.
The value of $menu4_entry is available outside of this, but not when checking the value of continue.
I need to have access to $menu4_entry after the user has clicked on OK or cancel, so I can then use its value to perform other things.
Any help on this greatly appreciated.
Start Free Trial