One of the most common active feature a website is the contact form.
I’m going to show you how to create a contact form using PHP.

The complete PHP contact form example will consist of six files. Below’s a brief description of these files.

  • phpform.htm – The main HTML form code
  • phpprocess.php – The PHP script which will process the submitted form and send an email
  • phpsettings.php – This is the file to configure the form
  • phpstyle.css – Basic CSS styles to format the form
  • phpvalidation.js – JavaScript validation file use when the form is submitted
  • phpthanks.htm – Page which hold the Thank you message shown after the form is submitted.

Here is a screen capture of how the form will appear (this is an image, not a function form!).

php contact form screen

File: phpform.htm


File: phpprocess.php


File: phpsettings.php


File: phpstyle.css


File: phpvalidation.js


File: phpthanks.htm


After you’ve had a chance to look through the above code, you should notice how things hang together.

Leave a Reply

*