Click to See Complete Forum and Search --> : Install - URL Variables not working
Using:
Solaris 2.6
Apache 1.3.12
PHP 4
Install went ok, everything works except when passing a URL Variable.
http://www.whatever.com/index.php?a=1&b=2
Do we have to enable something to get the URL Variables to work???
set the "register globals" to "on" under php.ini or use $HTTP_GET_VARS["a"]/$_GET["a"] to get the value of variable a
radley
05-17-2002, 08:04 PM
its not broken, its just the new php 4.2.0 setting, register_globals is off, so you must use superglobals.
$_POST[]: a form variable
$_GET[]: a url variable
$_REQUEST[]: a form or url variable
$_SERVER[]: a server variable
$_ENV[]: an enviorment variable
$_COOKIE[]: a cookie variable
$_SESSION[]: a session variable
$_FILES[]: a file variable
these arrays are always global inside or outside of a function. So if you wanted to print out the form variable 'formvar' you'd do
<?php
print $_POST['formvar'];
print $_POST["formvar"]; // you can use double-quotes too
?>
all the same rules apply with superglobals as with arrays
Radley you're the freekin boss m8, that has been causing me grief for hours now! and all fixed in 30 sec's thanks to you!
Pat your self on the back m8! ;)
Well Chuffed.
Dave
thanks from me aswell, also helped me :)
a pat from overhere aswell :)
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.