Page 1 of 1

I can't see the value of $PHP_SELF. It has no value.HELP!

Posted: Sat May 24, 2003 11:16 am
by Wentu
I installed an ApacheSever and the latest PHP version.
Simple tests seemed ok but now i am trying to use the variable $PHP_SELF and it seems it doesn't exists. BUT, if i write

Code: Select all

echo "we are in:",$_SERVER&#1111;"PHP_SELF"],"<br>" ;
i correctly see the path of the file.

if i write

Code: Select all

echo "we are in:",$PHP_SELF,"<br>" ;
i just see "we are in" and then "Undefined variable: PHP_SELF"

i worked with php elsewhere and this always worked. Where is the problem ?

thank you so much

Wentu

Posted: Sat May 24, 2003 11:25 am
by Wentu
ok i answer to myself.
It was due to
- register_globals = Off

in the php.ini file.

Now the question is: is it so important to keep this value off ? How do I use $PHP_SELF value then ? haev i always to write "$_SERVER["PHP_SELF"] ? Why is this better coding ?

Or is the use itself of PHP_SELF to be deprecated ???

thank you for any valuable explanations

Wentu

Posted: Sat May 24, 2003 2:00 pm
by volka
The best reason for you as coder is that $PHP_SELF is deprecated and might not be supported in future versions of php, although I doubt it ;)

Posted: Sat May 24, 2003 4:16 pm
by Wentu
$PHP_SELF is deprecated ?
oh...

so what should the *perfect_php_developer* do to send a form to the same page the form appears in and keep some portability ?

thankx again

Wentu

Posted: Sat May 24, 2003 4:21 pm
by m3mn0n

Code: Select all

<?php
$PHP_SELF = $_SERVER['PHP_SELF'];
?>
would be my best bet. :wink: