Skip to content

Instantly share code, notes, and snippets.

@element121
Last active May 25, 2016 22:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save element121/8e6aa58d0bf860c1416b41c02641f831 to your computer and use it in GitHub Desktop.
Save element121/8e6aa58d0bf860c1416b41c02641f831 to your computer and use it in GitHub Desktop.
<?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