Creating a contact form for your website

contact form contact us form download

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

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 DemoDownload

Contact form with simple captcha

Contact form with Simple Captcha
Try the DemoDownload

contact form with image captcha

Contact form with fields: Name, Email, Phone and Message (and Image Captcha)
Try the DemoDownload

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

    $formproc->AddRecipient('');//<<---Put your email address here
  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.

Sample iframe code to embed the form:

<iframe src='/contact/contactus.php' frameborder='0' width='100%' height='600' ></iframe>

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

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.


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

See Also