There are so many times we don’t want to use any PHP file (say contact.php) directly for our HTML websites to process contact form rather we prefer to use HTML contact page (say contact.html). It is not a hard task, we can do this by using Ajax or jQuery. In this tutorial, I am describing the easiest way to do the same.
The form will be in any HTML extension page with validation. What we need a separate PHP file for parsing email function only.
Here are the screen shots of the forms.


Step 1: Create an HTML page (contact.html) and write the form code with jQuery library CDN and validation script file adding.
Step 2: Add a JS file for the form validation and Ajax function of jQuery to get all the data from the submission of the form as soon as the form sends the values to email.php .
Step 3: Create a php file as email.php and write down the main PHP mail function.
Leave a Reply