Mail validation form

the mail() function

Moderators: egami, macek, gesf

Post Reply
User avatar
bigjoe11a
New php-forum User
New php-forum User
Posts: 137
Joined: Wed Aug 31, 2011 3:55 am
Location: USA
Contact:

Tue Sep 27, 2011 8:40 pm

I thought I just did this for some one else.

Code: Select all

<?php

function check_email($email){
    
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {

return true;
} else {
return false;
}
} // ends function


$email = $_POST['email'];

if (check_email($email)) {
echo $email . ' is a valid email address.<br />';
} else {
echo $email . ' is not a valid email address.<br />';
echo "<br><a href=index.php>Return</a>";
exit;
}

?>

Post Reply