We will use a Java Script regular expression to check either email ID is valid or not.Email ID Rules: We have simply put a textbox where user is supposed to enter Email ID and when press Submit button to save data, we will check either it is valid or not before saving to database. Add a Java Script function in your head section of form.It is important to validate the form submitted by the user because it can have inappropriate values. The Java Script provides you the facility the validate the form on the client side so processing will be fast than server-side validation.So, most of the web developers prefer Java Script form validation.Note that HTML email address validation will only work in browsers that support HTML5 and validate form element input.For other browsers and backup, you can still validate email addresses using PHP, for example.
But by mistake or intentionally, user entered wrong email ID, you need to contact to entered contact for validation or other purpose. This example proves why it is important to validate data before saving to database.