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

2002-08-02 Thread lallous

even on old versions of PHP,
he can then just use: $GLOBALS['PHP_SELF'] w/o worrying about the Global
keyword!

Elias
"John Holmes" <[EMAIL PROTECTED]> wrote in message
001001c23a1e$601f5050$b402a8c0@mango">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...




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




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

2002-08-02 Thread John Holmes

> 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...


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php