The easiest way to validate an email address in php and html
via html just use the type "email" for your input and the browser will do the rest if you don't have particular needs. Required will make your input mandatory.
Never use only client side validations/checks.
<?php if (filter_var('email@myemail.it', FILTER_VALIDATE_EMAIL) === false) { echo ' wrong email'; } ?>
via html just use the type "email" for your input and the browser will do the rest if you don't have particular needs. Required will make your input mandatory.
<input type="email" name="email" required>
Never use only client side validations/checks.
Comments
Post a Comment