Click to See Complete Forum and Search --> : query string variables problem


Anon
05-01-2002, 08:28 AM
This is sending me insane.
I have just installed the the pre compiled windows version of php(php-4.2.0-Win32.zip), on a win98 machine with apache (apache_1.3.24-win32-x86-no_src.msi)

For some reason variables in the query string are not being passed to my php scripts.
e.g.
http://127.0.0.1/test2.php?var1=hello

I though this should create a variable in the test2.php script called $var1 with a value of hello.

Also this does not work:

foreach ($HTTP_GET_VARS as $varvalue) {
echo $varvalue . "<br>"
}
}

I really am stuck any suggestions.

thanks

dave

Anon
05-01-2002, 09:00 AM
Think I have found the problem, in the php.ini, the 'register_globals' is defaulted to Off this results in variables from the query string being automatically available. To fix:
register_globals = On.

Any ideas why this has been done?

Anon
05-01-2002, 12:01 PM
Reguster globals being on means that anyone can intercept / adjust the variables by simply changing the URL.

PHP now comes with this turned off as you (should) reference post and get variables differently (using $_POST etc)

Cheers

Justin