Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- POST, GET and SESSION
July 25, 2007, 6:20 pm
rate this thread
variables could be passed along and accessed by various pages.
I am working on some legacy code that has been through several hands
over the years. The gist of it is that there is a "Register" button on
our website, that goes to a redirect page, that then calls a page that
displays our registration form. The URL the Register button uses
includes passing a variable. For instance, lets say the URL is
The thing is that on register.php there is no POST, GET or SESSION
anywhere. The redirect page does include the variable in the URL, but
that is all. It doesn't do anything else with it. I moved this entire
site from our production server to a test server. I can't imagine what
was in place on the original server that would have caught the
variable from the URL, stored it and then served it up to any page
that requested it. The only reference in the comments regarding where
the variable comes from is on register.php:
//$order, $code are defined from someplace...
That is the entire comment, and it is never mentioned again. So
presumably the last person to work on it wasn't sure how it was
working either. I did try using the GET method on the register.php
page which works. However, the register page is meant to be dynamic.
Meaning that it contains code for three different pages. As a user
finishes a page, they click NEXT. The page then reloads, check various
IFs and populates the next screen. I have thought of using an IF
($_SERVER['REQUEST_METHOD'] to either GET or POST the variable. But I
would like to try and figure out how the current system works. Any
guesses? They will be greatly appreciated.
Re: POST, GET and SESSION
In older versions of PHP variables such variables were automatically
imported into the global scope. This was called register_globals.
Without any further action there would have been a global variable $code
with the value '01'.
In recent PHP this "feature" is disabled for security reasons, in PHP 6
it will be dropped completely.