Validating an email address in php
Actually you need a valid email address all the time, but sometimes an additional check is necessary to reach your goals.
We use a second layer of email address validation for: Mailboxlayer is a service from apilayer, a company based in Vienna, Austria.
Check the “pattern” attribute where a regular expression is used to validate the form field value.
And of course you can use HTML5 also to set a required field.
This might be enough for smaller sites, but only if you submit only those addresses with a “good” email address format. Besides a check on the email address format, Mailboxlayer is using different methods to check your submitted email address: There are different ways to check the email address format.
This way only the “good” formatted email addresses need to be processed by your PHP function.
If you don’t like to use Java Script for the client side validation, it’s also a good idea to use HTML5 form field validation.
Beside PHP we use a lot of j Query code for our website projects.
Using the following Java Script (j Query) code you can check an email address without a page reload.