Dave M G wrote:
PHP list,
I have many times set the value of a variable by declaring it in the
URL, like so:
http://www.domain.com/index.php?var=1
And then, to use the variable, all I have to do is use it in the script,
like so:
echo "This is the value of the variable: " . $var;
But, for some reason, in a script I'm writing now, this simple process
isn't working.
The only thing I can think of that is different between before and now
is that the new script is being executed in PHP5, whereas before was
with PHP4.
In my new script, I check the value of $_SERVER['QUERY_STRING'], the
value is contained in there, so it is being assigned and contained somehow.
What could I possibly be missing in what should be a super simple process?
--
Dave M G
Before, you were relying on PHP's register_globals setting, which did
what you describe. Since the use of this setting is an enormous security
hole, and there is zero reason to use it outside of backwards
compatibility with old scripts, it has long since been disabled by default.
You should instead reference GET variables like so:
$_GET['var']
And POST like this:
$_POST['var']
This is much safer. If you REALLY want to turn on register_globals (And
I strongly recommend against it, it's a huge risk), information on how
to do this can be found in the PHP manual.
Regards, Adam.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php