RE: [PHP-DB] Can't do anything with variables
| From: | John W. Holmes | Date: | Mon, 07 Apr 2003 10:42:51 +0000 |
| Subject: | RE: [PHP-DB] Can't do anything with variables | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-26891@lists.php.net to get a copy of this message | ||
> > The problem. Even if I fill both fields, I always get "Notice:
Undefined
> variable: searchtype"
> >
> </snip>
>
> My guess is that you are using a windows platform ? The windows
version
> of PHP doesn't like variable testing syntax like:-
>
> if ($testvar) { echo "hallo"; } // You can get away with this on
*nix.
>
> It insists that you use:-
>
> if (isset($testvar)) { echo "hallo"; }
Ummm, that has nothing to do with windows. It will work on any platform,
but may give a WARNING depending on your error_reporting() level. But
yes, it is a good idea to use isset(), regardless. Remember that
textboxes will always be set, even if nothing was typed in. Only buttons
and checkboxes can really come across "not set".
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/