RE: [PHP] Re: Undefined Variable in IF...ELSE IF ...ELSE IF (NEWBIE ?)
| From: | Dave | Date: | Fri, 15 Mar 2002 20:57:37 +0000 |
| Subject: | RE: [PHP] Re: Undefined Variable in IF...ELSE IF ...ELSE IF (NEWBIE ?) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-88706@lists.php.net to get a copy of this message | ||
I have been sloppy in teh past and just used
if($submit) blah blah blah
not sure of ramifications, but seems to work unless $submit is "false" or not
set.
again, take with grain of salt, other suggestions (especially isset) are much
more certain.
Dave
>-----Original Message-----
>From: mnc@stoic.net [mailto:mnc@stoic.net]
>Sent: Friday, March 15, 2002 3:46 PM
>To: Daniel Negron/KBE
>Cc: php-general@lists.php.net
>Subject: Re: [PHP] Re: Undefined Variable in IF...ELSE IF ...ELSE IF
>(NEWBIE ?)
>
>
>On Fri, 15 Mar 2002, Daniel Negron/KBE wrote:
>> Thank You Charlie. I also found out that I needed to put an "@" symbol
>> infrom of the string. This stopped it from throwing me an error.
>>
>> If(@$submit) blah blah blah
>
>Better yet, use:
>
> if (isset($submit)) blah blah blah
>
>That explicitly checks to see whether the variable has been defined
>previously in the run, which makes your code easier to understand and
>avoids the klugey @.
>
>miguel
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>