Re: strstr Question
| From: | Mark Maggelet | Date: | Mon, 13 Aug 2001 01:08:44 +0000 |
| Subject: | Re: strstr Question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-62358@lists.php.net to get a copy of this message | ||
On Sun, 12 Aug 2001 18:42:48 -0500, Erich Zigler
(erichz@superhero.org) wrote:
>I am currently writing a piece of code that when a user enters in
>their
>email address it will check it for validity.
>
>In this instance they are supposed to type in user@domain.com But if
>they
>just type in user I want it to add @domain.com at the end by
>default. This
>is the piece of code I have so far, but it does not seem to be
>working...
>
>if (strstr($email, '@')) {
> continue;
>} else {
> $email = $email . "@domain.com";
>}
>
>I've been all over the documentation but I am obviously missing
>something.
>If anyone could be of any assistance I would greatly appreciate it.
continue is for loops, not if's. delete that line and it should work,
or better yet:
if (!strstr($email, '@')) $email.="@domain.com";