Page 1 of 1

passing a variable to a redirected page

Posted: Wed Sep 09, 2009 8:20 pm
by james20
I need to pass a variable from the current page to a redirect of the same page.

For instance, submit.php?step=10 is where I would need to set the variable. Then I redirect back to submit.php and check if that variable is set.


I tried using:

Code: Select all

 
http_redirect("submit.php", array("edited" => 1, true, HTTP_REDIRECT_PERM);
 
with:

Code: Select all

 
isset($_SESSION['edited'])
 
That did not work, but I'm not sure that's the best way of doing things. In short, I simply want to set a variable that I can access from a page that I redirect to.

What are my options for doing this?

Re: passing a variable to a redirected page

Posted: Wed Sep 09, 2009 8:28 pm
by Mirge
james20 wrote:I need to pass a variable from the current page to a redirect of the same page.

For instance, submit.php?step=10 is where I would need to set the variable. Then I redirect back to submit.php and check if that variable is set.


I tried using:

Code: Select all

 
http_redirect("submit.php", array("edited" => 1, true, HTTP_REDIRECT_PERM);
 
with:

Code: Select all

 
isset($_SESSION['edited'])
 
That did not work, but I'm not sure that's the best way of doing things. In short, I simply want to set a variable that I can access from a page that I redirect to.

What are my options for doing this?
Instead of using $_SESSION['edited'], try accessing $_GET['edited']. Let me know if that works please.