Page 1 of 1

Short Little Test Script Going Wrong with $_GET

Posted: Fri Jan 17, 2003 4:38 am
by sane993
Hello,
I'm just testing this out and cant get it to work.

1st File <test.php>

Code: Select all

<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>

<BODY>
<A HREF="test2.php?name=test">Click Me!</A>
</BODY>
</HTML>
2nd File <test2.php>

Code: Select all

<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>

<BODY>
<?php
$name = $_HTTP_GET_VARS&#1111;"name"];
echo $name;
?>	
</BODY>
</HTML>
And when test2.php is loaded I get a blank page. Whats going wrong?
btw, PHP Version 4.3.0

Thanks
-sane993

Posted: Fri Jan 17, 2003 4:48 am
by volka
just an underscore too much. $HTTP_GET_VARS
somewhere in your webserver's error.log should be an entry "Notice: Undefined variable: _HTTP_GET_VARS in [...]\test2.php on line [...]"

if you're just testing php you might want to set error_reporting = E_ALL and display_errors = On in your php.ini. The latter applies only for the the development system and if you do not want to open the server's error.log ;)

Posted: Fri Jan 17, 2003 4:52 am
by sane993
Thanks Man. :wink:

Posted: Fri Jan 17, 2003 5:22 am
by twigletmac
Since you're using PHP 4.3.0 you can use $_GET instead of $HTTP_GET_VARS (unless of course you are writing code that needs to run on PHP <= 4.0.6).

For more info:
http://www.php.net/manual/en/language.v ... efined.php

Mac

Posted: Fri Jan 17, 2003 5:29 am
by Beans
I'm using PHP 4.02 (i think... anyway, it's 2 minor versions short of 4.3) and whenever I use the $_GET variable, it returns an Undefined variable....

Posted: Fri Jan 17, 2003 5:31 am
by volka
twigletmac wrote:unless of course you are writing code that needs to run on PHP <= 4.0.6
;)
http://www.php.net/manual/en/reserved.v ... iables.get

and

Code: Select all

<?php phpinfo(); ?>
or

Code: Select all

<?php echo phpversion(); ?>
will tell you your version of php.