Re: checking for null form fields fails
| From: | Mark Maggelet | Date: | Tue, 07 Aug 2001 16:26:48 +0000 |
| Subject: | Re: checking for null form fields fails | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-61662@lists.php.net to get a copy of this message | ||
>Well, Mark... almost! You shouldn't use empty() _instead_ of
>isset(). You should use 'm together:
>
> if (isset ($input) && !empty($input)) {
> print ("Okay... form is completed!");
> } else {
> print ("No way... can't do!");
> }
>
>Because, when you check using empty($input) there's still the
>possibility that $input isn't defined at all. And then some horrible
>error still arises in your logfile.
This isn't right, empty() won't give an error if $input isn't set.