Re: [PHP] $PHP_SELF in include files
On Tue, 2002-03-12 at 15:17, David Johansen wrote: > Here's the chunk of code in the include file that gave me that. I should > have put it with the original post: Ach. Well, $PHP_SELF is in the global scope, so you will either need to use 'global $PHP_SELF;' at the beginning of your function, or reference it as $GLOBALS['PHP_SELF']. If you do one, you don't need to do the other. If you're using PHP 4.1.0 or later, just use $_SERVER['PHP_SELF']; > function questions() > { // Add this here, or use one of the next ones below. global $PHP_SELF; > ?> > U face="Times New Roman" size="2"> > > color="#CC">Questions > size="2"> > Insert questions here. > } > ?> > > Thanks, > Dave Good luck! Torben -- Torben Wilson <[EMAIL PROTECTED]> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $PHP_SELF in include files
On Tue, 12 Mar 2002, David Johansen wrote: you might try global $PHP_SELF; in that function... > Here's the chunk of code in the include file that gave me that. I should > have put it with the original post: > > function questions() > { > ?> > U face="Times New Roman" size="2"> > > color="#CC">Questions > size="2"> > Insert questions here. > } > ?> > -- Jan Rademaker <[EMAIL PROTECTED]> http://www.ottobak.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $PHP_SELF in include files
> function questions() > { [snip] > } > ?> $PHP_SELF is unknown to the function "questions()". You'll need to add "global $PHP_SELF" at the top of the function. Jason -- Jason Murray [EMAIL PROTECTED] Web Developer, Melbourne IT "Work now, freak later!" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $PHP_SELF in include files
On Tue, 2002-03-12 at 15:13, David Johansen wrote: > I'm doing exactly what you said and here's what it says when I call > $PHP_SELF in the include file: > > http://12.254.227.149/Warning:%20%20Undefined%20variable:%20%20PH > P_SELF%20in%20c:/inetpub/wwwroot/pages.inc%20on%20line%2035 >?page=questions You probably have register_globals turned off, as it should be. In versions of PHP from 4.1.0 onward, it's off by default; see http://www.php.net/release_4_1_0.php for more information. In short, try $_SERVER['PHP_SELF'] and see what you get. Hope this helps, Torben > "Lars Torben Wilson" <[EMAIL PROTECTED]> wrote in message > 1015974570.2134.94.camel@ali">news:1015974570.2134.94.camel@ali... > > On Tue, 2002-03-12 at 15:02, David Johansen wrote: > > > Is there a way that I can use $PHP_SELF in include files, so that the > > > function will use the URL of the php script that calls the include file? > > > Thanks, > > > Dave > > > > If a.php includes b.php, and you check $PHP_SELF in b.php, it should > > give you the path to a.php. What result are you getting? > > > > > > -- > > Torben Wilson <[EMAIL PROTECTED]> > > http://www.thebuttlesschaps.com > > http://www.hybrid17.com > > http://www.inflatableeye.com > > +1.604.709.0506 > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Torben Wilson <[EMAIL PROTECTED]> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $PHP_SELF in include files
Here's the chunk of code in the include file that gave me that. I should have put it with the original post: U Questions Insert questions here. Thanks, Dave "Lars Torben Wilson" <[EMAIL PROTECTED]> wrote in message 1015974570.2134.94.camel@ali">news:1015974570.2134.94.camel@ali... > On Tue, 2002-03-12 at 15:02, David Johansen wrote: > > Is there a way that I can use $PHP_SELF in include files, so that the > > function will use the URL of the php script that calls the include file? > > Thanks, > > Dave > > If a.php includes b.php, and you check $PHP_SELF in b.php, it should > give you the path to a.php. What result are you getting? > > > -- > Torben Wilson <[EMAIL PROTECTED]> > http://www.thebuttlesschaps.com > http://www.hybrid17.com > http://www.inflatableeye.com > +1.604.709.0506 > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $PHP_SELF in include files
I'm doing exactly what you said and here's what it says when I call $PHP_SELF in the include file: http://12.254.227.149/Warning:%20%20Undefined%20variable:%20%20PH P_SELF%20in%20c:/inetpub/wwwroot/pages.inc%20on%20line%2035?page=questions "Lars Torben Wilson" <[EMAIL PROTECTED]> wrote in message 1015974570.2134.94.camel@ali">news:1015974570.2134.94.camel@ali... > On Tue, 2002-03-12 at 15:02, David Johansen wrote: > > Is there a way that I can use $PHP_SELF in include files, so that the > > function will use the URL of the php script that calls the include file? > > Thanks, > > Dave > > If a.php includes b.php, and you check $PHP_SELF in b.php, it should > give you the path to a.php. What result are you getting? > > > -- > Torben Wilson <[EMAIL PROTECTED]> > http://www.thebuttlesschaps.com > http://www.hybrid17.com > http://www.inflatableeye.com > +1.604.709.0506 > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $PHP_SELF in include files
On Tue, 2002-03-12 at 15:02, David Johansen wrote: > Is there a way that I can use $PHP_SELF in include files, so that the > function will use the URL of the php script that calls the include file? > Thanks, > Dave If a.php includes b.php, and you check $PHP_SELF in b.php, it should give you the path to a.php. What result are you getting? -- Torben Wilson <[EMAIL PROTECTED]> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php