Last active
May 25, 2016 22:17
-
-
Save element121/8e6aa58d0bf860c1416b41c02641f831 to your computer and use it in GitHub Desktop.
This file contains 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 (isset($_POST['email'])) | |
{ | |
// Grab the POSTed email address input field | |
$email = $_POST['email']; | |
// Use filter_var to check if the email address is valid | |
if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) { | |
echo("$email is not a valid email address"); | |
} else { | |
echo("$email is a valid email address"); | |
} | |
} | |
?> | |
<!DOCTYPE html> | |
<body> | |
<form action="" method="POST"> | |
Email address: | |
<input type="email" name="email" required placeholder="Enter your email"> | |
<input type="submit"> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment