Re: OT: PHP_SELF

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ (text/plain)
Delete this message
Reply to this message
Author: Randy Melder
Date:  
To: Main PLUG discussion list
Subject: Re: OT: PHP_SELF
$_SERVER['PHP_SELF'] will yield 'index.php', not '/index.php'.

so your condition should read:

if($_SERVER['PHP_SELF'] == 'index.php')
{
echo "do something....";
}

On 10/15/06, Slide <> wrote:
>
> A trick that will let the PHP interpreter find these sorts of things
> is to put the constant first, e.g.
>
> <?php
>    if("/index.php" = $_SERVER['PHP_SELF']) {
>         echo "blah blah";
>    }
> ?>

>
> The interpreter should pick that up and flag it as you can not assign
> to a constant.
>
> slide
>
> On 10/14/06, John Seth <> wrote:
> > Your example should be:
> >
> > <?php
> >     if ($_SERVER['PHP_SELF'] == "/index.php") {
> >         echo("blah blah blah html to include picture");
> >     }
> > ?>

> >
> > You need the double '==' in there for comparing. A single = is used when
> > assigning values to variables.
> >
> > HTH,
> >
> > Tony Evans
> > Phoenix Wing Interactive
> >
> > http://www.phoenixwing.com/
> >
> >
> >
> > Joseph Huber wrote:
> > > OT so I'll keep this short and cross my fingers... LAMP set-up, a
> novice, a
> > > particular page that I want to display a picture on (and only
> that page).
> > > The following seems reasonable:
> > >
> > > <?php
> > >     if ($_SERVER['PHP_SELF'] = "/index.php") {
> > >         echo("blah blah blah html to include picture");
> > >     }
> > > ?>

> > >
> > > seemed reasonable. Only thing is (on the index page) on my box were I
> test
> > > everything I'm not finding "/index.php" in the indicated variable. I'm
> > > getting "/includes/stdMenu.php" which is the path to the script on my
> test
> > > box. I plug a <?php echo $_SERVER['PHP_SELF']; ?> into the footer that
> > > appears on every page and upload that to my hosting provider and I get
> what
> > > I expect... the path to the page I happen to be looking at:
> "/index.php" or
> > > "/news/newsltr0609.php" etc).
> > >
> > > I'm thinking this is a configuration issue. Not sure if it's Apache or
> PHP.
> > > Can someone point me somewhere... I've been googling for the last
> couple
> > > days and nothing I've foud seems to be related to my problem :-(
> > >
> > > Stumped in Chandler
> > >
> > >
> > > ---------------------------------------------------
> > > PLUG-discuss mailing list -
> > > To subscribe, unsubscribe, or to change you mail settings:
> > > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
> > >
> > >
> > ---------------------------------------------------
> > PLUG-discuss mailing list -
> > To subscribe, unsubscribe, or to change you mail settings:
> > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
> >
> ---------------------------------------------------
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>




--



http://spindomains.us/
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss