<?php
Function ValidEmail($email)
{
if (eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$" , $email))
return true;
else
return false;
}
?>
<?php
$mail1 = "iain@excite.com";
If (ValidEmail($mail1))
echo "valid email address";
Else
echo "invalid email address";
?>
i understand this now. its checking the varible mail1: so "iain@excite.com" is valid.
<?php
$formemail = "tazhotm.com";
?>
<?php
Function ValidEmail($email)
{
if (eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$" , $email))
return true;
else
return false;
}
?>
<?php
$mail1 = "$formemail";
If (ValidEmail($mail1))
echo "valid email address";
Else
echo "invalid email address";
?>
and i can declare the varible like this. so this email is incorrect now.
but how do i get the email from a form? and is it possible to do it all in the same script?