Re: $PHP_SELF in include files
| From: | Lars Torben Wilson | Date: | Tue, 12 Mar 2002 23:27:24 +0000 |
| Subject: | Re: $PHP_SELF in include files | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-88266@lists.php.net to get a copy of this message | ||
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'];
> <?php
> function questions()
> {
// Add this here, or use one of the next ones below.
global $PHP_SELF;
> ?>
> <font face="Times New Roman" size="5"
> color="#003399">U</font></b><font
> face="Times New Roman" size="2">
> </font><font face="Times New Roman" size="4"><b>
> <a href="<?php echo $PHP_SELF?>?page=questions"><font
// This before PHP 4.1.0:
<a href="<?php echo
$GLOBALS['PHP_SELF']?>?page=questions"><font
// This after PHP 4.1.0:
<a href="<?php echo
$_SERVER['PHP_SELF']?>?page=questions"><font
> color="#CC0000">Questions</font></a></b></font><font
> face="Times New Roman"
>
> size="2"><BR>
> Insert questions here.</font><P><b>
> <?php
> }
> ?>
>
> Thanks,
> Dave
Good luck!
Torben
--
Torben Wilson <torben@php.net>
http://www.thebuttlesschaps.com
http://www.hybrid17.com
http://www.inflatableeye.com
+1.604.709.0506