RE: [PHP] Why do i get this Notice Message?

From: Date: Fri, 02 Aug 2002 12:16:04 +0000
Subject: RE: [PHP] Why do i get this Notice Message?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-110808@lists.php.net to get a copy of this message
> Could someone please tell me why i get the following Notice Message > > Notice: Undefined variable: PHP_SELF in > g:\apache_web\intern\looney\index.php on line 101 > > Code affected: > > function WriteNewArticle() > { > Line 100: $smarty = new Smarty; > Line 101: $smarty->assign("PHPSELF", $PHP_SELF); > // etc..... Why? Because $PHP_SELF is an undefined variable. There is nothing assigned to it and you're trying to use it in a function. But, you say, $PHP_SELF is supposed to be the current page. Yes, normally it would with register_globals ON, but you are inside of a function, so it is a whole new variable now. So, like someone else suggested, make it global inside your function Global $PHP_SELF; Or, if you're on a new version, just use $_SERVER['PHP_SELF'] and you don’t have to worry about global. ---John Holmes...

« previous php.general (#110808) next »