Created
June 24, 2011 19:54
-
-
Save agustinferreira/1045539 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($_POST['email'] != "") | |
{ | |
$email = filter_var($_POST['email'] , FILTER_SANITIZE_EMAIL); | |
if(!filter_var($email, FILTER_VALIDATE_EMAIL)) | |
{ | |
$result = "The mail you entered is not a valid email address."; | |
} | |
$link = mysqli_connect('localhost','root',''); | |
mysqli_select_db($link,'newsletter'); | |
$sql = 'INSERT INTO newsletter SET email = "' . $email . '"'; | |
$sql1 = 'SELECT email FROM newsletter WHERE email = "' . $email . '"'; | |
if (mysqli_query ($link, $sql1)) | |
{ | |
$result = "Your email is alredy registered."; | |
} | |
if (mysqli_query ($link, $sql)) | |
{ | |
$result = "Your email has been successfully registered. Thanks for your interest in SABF!"; | |
} | |
} | |
else | |
{ | |
$result = 'Please enter your email address.<br/>'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment