Posted by Peter van Schie on 12/07/05 00:56
mike wrote:
> If this is my first bit of code:
>
> if ($var == "value") {
> do something
> }
>
> and $var isn't defined in the url string, or via a FORM post or hidden
> variable then is this the reason why I keep getting errors like this?
>
> [Tue Dec 6 10:02:51 2005] [error] PHP Notice: Undefined variable: var in
> /usr/home/mike/index.php on line 3
>
> which are apparently causing my server to crash? does $var need to be
> defined before I can use it in a if statement? ie myurl/index.php?var=blah
Hi Mike,
Try
if ($_GET['var'] == "value")
{
// do something
}
In php.ini the setting register_globals is set to Off by default as of
PHP version 4.2 (if I remember correctly).
HTH.
Peter.
--
http://www.phpforums.nl
[Back to original message]
|