RE: [PHP] PHP not working, giving "undefined variable"
| From: | PHP Spooky | Date: | Sat, 24 May 2003 21:17:26 +0000 |
| Subject: | RE: [PHP] PHP not working, giving "undefined variable" | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-148882@lists.php.net to get a copy of this message | ||
Hmmm... makes sense.
Thanks,
PHPSpooky
There IS an error, actually. Checking !$submit first converts $submit
to boolean
(http://us3.php.net/manual/en/language.types.boolean.php#language.types.
boolean.casting).
If the variable isn't set at all (as opposed to being set to nothing),
PHP generates a notice (since you're accessing an unset variable) and
returns a NULL value. This has the desired effect, but is still wrong.
To avoid the notice, use !isset($submit) instead.