Jump to content

[SOLVED] If statement to check email variable


denoteone

Recommended Posts

I need to make an if statement that checks to see if my variable $_POST['email']  has @mysite.com  in it.

 

 

if (!get_magic_quotes_gpc()) {
$_POST['email'] = addslashes($_POST['email']);
}

 

this is where I need to make sure that the email has @mysite.com in it. If not then die('Your email must end in @mysite.com');

 

$usercheck = $_POST['email'];
$check = mysql_query("SELECT email FROM users WHERE email = '$usercheck'")
or die(mysql_error());
$check2 = mysql_num_rows($check);

//if the name exists it gives an error
if ($check2 != 0) {
die('Sorry, the email '.$_POST['email'].' is already in use.');
}

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.