Re: where is PHP_SELF?

From: Date: Thu, 31 Jan 2002 23:12:27 +0000
Subject: Re: where is PHP_SELF?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-83026@lists.php.net to get a copy of this message
On Thu, 2002-01-31 at 14:57, Erik Price wrote: > I have a file called "index.php". This file includes another file, > "foot.inc". In the file "foot.inc", amidst much HTML code, I have a > simple line: > > <?php > echo "<p>$PHP_SELF</p>" ; > ?> > > The expected result is that "<p>index.php</p>" will appear in my web > page, or at least something will appear. Yet, when the page is served > to my browser, all that shows up is the "<p></p>". The variable > $PHP_SELF isn't getting through. Am I doing something wrong, or is this > because that variable is assigned to the name "foot.inc", and has been > included into another file? Does the name of the page served not get > passed onto the include file, where $PHP_SELF is echoed? > > Thanks for any insight you can give, > > Erik > > PS: I have an Apache directive that prevents any "*.inc" files from > being served, but that doesn't stop them from being parsed as PHP. I'm > running PHP 4.1.0 on LAMP w/register_globals=off ^^^^^^^^^^^^^^^^^^^^ Since register_globals is off, the $_SERVER array will not be extracted into the global scope. Try $_SERVER['PHP_SELF'] and you should be fine. Hope this helps, Torben > ---- > > Erik Price > Web Developer Temp > Media Lab, H.H. Brown > pricee@hhbrown.com -- Torben Wilson <torben@php.net> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506

« previous php.general (#83026) next »