Re: String manipulation
| From: | Erwin | Date: | Thu, 24 Oct 2002 14:18:50 +0000 |
| Subject: | Re: String manipulation | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-121273@lists.php.net to get a copy of this message | ||
"Francisco Vaucher" <fvaucher@tycoint.com> wrote in message
news:3B966ABC166BAF47ACBF4639003B11AC848AE7@exchange.adtarg.com...
>
> Hi to all (again ;-)
>
> I need one or more PHP functions to handle a form input.
>
> i.e. you write: test@test.com
>
> I have to check that after the '@' comes 'test.com'. I think this is easy,
Something like this?
$address = explode( '@', $_POST['email'] );
if ( $address[1] == 'test.com' )
echo 'Valid';
else
echo 'Not valid';
or:
if ( preg_match( '/.*@test\.com$/', $_POST['email'] ) )
echo 'Valid';
else
echo 'Not valid';
$_POST['email'] contains the email address, submitted by the form.
HTH
Erwin