Re: validating form data...
| From: | Mike Frazer | Date: | Mon, 22 Oct 2001 17:04:36 +0000 |
| Subject: | Re: validating form data... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71847@lists.php.net to get a copy of this message | ||
To verify the existence of both a name and message, try a test similar to
the following:
if ((email_is_valid($email)) && (strlen($name) > 0) && (strlen($name) > 0))
{ ... }
I've found that using "" in a conditional block tends to be a bit buggy.
strlen() seems to be pretty solid for verifying the existence of text in a
variable.
Mike Frazer
"Toke Herkild" <cafe@hodclub.dk> wrote in message
news:20011022115945.45960.qmail@pb1.pair.com...
> I've made a script which ought to validate if there is data in the fields
or
> not... but it doesn't seem to work...
>
> the validation is following:
> if ((email_is_valid($Email)) and ($Name != "") and ($Message != "")){
> do stuff ...
> }
>
> But even if I submit an empty form it executes "do stuf..."
> I have tried to put an empty space into the $Name and $Message test but
that
> doesn't seem to do any difference either...
>
>