Jump to content

[SOLVED] E-Mail Validation


jr_cumbo

Recommended Posts

Hi,

 

Just wondering if someone can see something wrong with this code.

 

<?php
$email=($_POST['email']);

if (isset($_POST['submit']) and $email !== '')
{
	if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email));
	{
		echo "<font color=red><b><---[ERROR]:Please enter a vaild E-Mail Address</font>";

		}

}
if (isset($_POST['submit']))
{
	if (($_POST['email']) == '')
	{
		echo "<font color=red><b><---[ERROR]:</b>Please enter a Email Address</font>";
                       }

}
?>

 

It will not validate the e-mail correctly.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/113215-solved-e-mail-validation/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.