p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: having a bit of trouble


Message #1 by "Jason DeWitt" <roxet@c...> on Wed, 24 Apr 2002 13:46:24 -0500
I seem to be having a bit of trouble with my php application. I've got a
form that submits itself to the same page using the $PHP_SELF constant. Now,
when I try to run the script I get this error message

Notice: Undefined variable: PHP_SELF

I've tried changing the error reporting in the php.ini file, this doesn't
fix it.  Also, just making php stop telling me about the error doesn't sound
like the best idea anyways. =/

Any ideas?
Jason

Message #2 by "Nikolai Devereaux" <yomama@u...> on Wed, 24 Apr 2002 11:56:38 -0700
> I seem to be having a bit of trouble with my php application. I've got a
> form that submits itself to the same page using the $PHP_SELF
> constant. Now,
> when I try to run the script I get this error message
>
> Notice: Undefined variable: PHP_SELF
>
> I've tried changing the error reporting in the php.ini file, this doesn't
> fix it.  Also, just making php stop telling me about the error
> doesn't sound
> like the best idea anyways. =/


You're probably using $PHP_SELF from within a function.  It's a global
variable, but you need to import it into function scope

function get_crazy_go_nuts()
{
    global $PHP_SELF;

    ...
}



take care,

nik

Message #3 by "Jason DeWitt" <roxet@c...> on Wed, 24 Apr 2002 14:06:42 -0500
right before I read your email I thought "Hey! I'm using this in a function,
I wonder if I shoudl do 'global' on it?"

Thanks for the help

jason

----- Original Message -----
From: "Nikolai Devereaux" <yomama@u...>
To: "beginning php" <beginning_php@p...>
Sent: Wednesday, April 24, 2002 1:56 PM
Subject: [beginning_php] RE: having a bit of trouble


>
> > I seem to be having a bit of trouble with my php application. I've got a
> > form that submits itself to the same page using the $PHP_SELF
> > constant. Now,
> > when I try to run the script I get this error message
> >
> > Notice: Undefined variable: PHP_SELF
> >
> > I've tried changing the error reporting in the php.ini file, this
doesn't
> > fix it.  Also, just making php stop telling me about the error
> > doesn't sound
> > like the best idea anyways. =/
>
>
> You're probably using $PHP_SELF from within a function.  It's a global
> variable, but you need to import it into function scope
>
> function get_crazy_go_nuts()
> {
>     global $PHP_SELF;
>
>     ...
> }
>
>
>
> take care,
>
> nik
>
>
>


  Return to Index