PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
hey my verification isnt working it just goes ahead and sends the email without checking it. could someone look over the code and properly tell me how to do the code? thanks
ok so i copied this code how would i make it so if it returned empty or not in the eregi pattern so it errored in the email form instead of just sending it plus erroring or just sending it?
function ValidateMail($Email) {
$result = array();
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $Email)) {
$result[0]=false;
$result[1]="$Email is not properly formatted";
return $result;
}
}
darkfreaks wrote:Ok, so I copied this code. How would I make it so if it returned empty or not in the eregi pattern, so it would error in the email form instead of just sending it plus erroring?
Please use punctuation and proper grammar when possible, it took me 5 read overs to even understand what you said
function ValidateMail($Email) {
return eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $Email);
}
if (ValidateMail($email)) {
echo 'Email has been sent';
mail( .. );
}
else
{
echo $email .' is not a valid address';
}