Re: Why do i get this Notice Message?
| From: | lallous | Date: | Fri, 02 Aug 2002 13:56:15 +0000 |
| Subject: | Re: Why do i get this Notice Message? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-110814@lists.php.net to get a copy of this message | ||
even on old versions of PHP,
he can then just use: $GLOBALS['PHP_SELF'] w/o worrying about the Global
keyword!
Elias
"John Holmes" <holmes072000@charter.net> wrote in message
news:001001c23a1e$601f5050$b402a8c0@mango...
> 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...