A Simple PHP Contact Form Code. A Contact Form Using Phpmailer. Free Bootstrap Contact Form With PHP. Bootstrap Contact Form With Captcha. Bootstrap 3 Contact Form. Contact Form HTML/CSS Template. HTML5 Contact Form To Send Email On Form Submission. HTML, CSS Email Contact Form. A contact form for your own website - create your own contact form quickly and easily - with anti-spam protection and, of course, completely free! A free contact form for your website.

  1. Contact Form Html Code Free Download Sites
  2. Simple Contact Form Code Html

This page presents the sample code for a simple 'contact us' form. The form collects a few pieces of information ( email, name and a message ) from your visitor and emails it to you.

Note: You can make contact forms quickly with Simfatic Forms. Simfatic Forms helps you to make complete, feature-rich forms and get it online quickly. Read more here.

Contact form html code free download pdf

Get more free, ready to use form downloads at ReusableForms.com

# Why to have a contact form?

'Contact us' forms are essential for almost any website. The 'contact us' form provides an easy interface through which your visitors can communicate to you. Your visitors can quickly submit their views, opinions, and suggestions about your website, product or service.

# The HTML contact form code

We will create a simple contact form with 3 fields: name, email address and a message field. Making the contact form simple (any form - for that matter) gets you more submissions. The more the number of fields, the more reluctant your visitors will be to submit the form.

The HTML code of the form is given below:

In the contact form download, the form code is in the email-contact-form.html page. To embed the form in a web page, just copy and paste the HTML form code to the web page.

# Validating the form submission

Form validations are essential for any web form. For this simple contact form, we will make all the fields mandatory and will make sure that the email field is in the format: name@domain.tld.

It is better to do validations both on the client-side and on the server-side. Client-side validation provides quick feedback to your visitor. However, the client-side validation can just be bypassed by disabling JavaScript in the browser. Therefore, we need to validate on the server-side as well.

For client-side validation, we will use the Free JavaScript Form Validation Script. The script is very simple to use and has almost all validation types built-in.

Here is the client-side form validation code:

# Server-side processing

Once the contact form is submitted, the form submission data is sent to the script mentioned in the action attribute of the form (contact-form-handler.php in our form). The script then will collect the form submission data, validate it and send the email.

The first step is to validate the data. Ensure that the mandatory fields are filled in, and that the email is in the proper format.

The server-side code is given below:

# Emailing the form data using PHP

We will now compose and send the email.

We first check whether the validations succeeded. If there were errors, the email is not sent. The PHP mail function is used to send the email. After sending the email, the visitor is redirected to the 'thank you' page.

# Download the code for the contact form

The download contains the code for the HTML form, the validations, and the PHP form handler.

# More Contact forms:

Here is a 'ready to use' form that you can simply plug-in to your web site. All that you have to do is to download the code below, update the code to include your email, and attach form to your web site. You can easily customize the form for your needs. The code is 100% validated XHTML1.0 strict.

Also see: free form downloads from ReusableForms.com

# Features of this contact form

  • Standards compliant, accessible form
  • 100% XHTML 1.0 strict validated, uses CSS2
  • Secured against spam and attacks
  • Validations done both on client side and on the server side
  • Uses PHPMail to send email
  • Easy to customize
  • Hosted on your own web server
  • Free!

# Download the contact form code

You can download the contact form that best fits your needs and then customize as required.

Simple contact form with three fields: Name, Email and Message
Try the Demo | Download
Contact form with Simple Captcha
Try the Demo | Download
Contact form with fields: Name, Email, Phone and Message (and Image Captcha)
Try the Demo | Download

Contact Form Html Code Free Download Sites

# Installing the contact form on your web site

  1. Unzip the downloaded contact form code.

  2. Edit contactform.php and edit the email address to your email address

  3. Upload the folder contents to your website (to a sub-folder say, /contact)

  4. The contactform.php contains the form. You can link to this file or embed the form using iframe.

Contact Form Html Code Free DownloadDownload

Sample iframe code to embed the form:

Alternatively, you can modify contactform.php to have the same look of your web site.

# Customizing the form

The contact form can be customized to match requirements. You can change the style, add more fields, and add more email recipients.

# Changing the colors, fonts and style

You can edit the contact.css file to change the style of the form.

# Adding more than one recipients

Call the AddRecipient() function passing the email address of the new recipient.Example:

# Adding more fields

Simple Contact Form Code Html

You can add any type of additional fields to the form. The fields will automatically be included in the form submission emails.

# More Customizations ...

For more features and customizations of the contact form, see the Related Pages section below.

# License

The code is shared under LGPL license. You can freely use it on commercial or non-commercial websites.