You are here: Home » All Posts » Contact Forms » A simple, easy PHP contact form

A simple, easy PHP contact form

in Contact Forms

Adding a contact form helps in getting good leads quickly. Contact forms need not be complex. Here is a simple but powerful contact form that you can just download, customize and plug-in to your website.

Download the contact form code

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

simple contact form
A simple contact form with three fields: Name, Email and Message
Try the DemoDownload
Another simple contact form
A simple contact form with fields: Name, Email, Phone number and Message
Try the DemoDownload
simple contact form with captcha
A simple contact form with a simple anti-spam mechanism
Try the DemoDownload

Features of the contact form

  • Simple contact form
  • Standards compliant (100% XHTML 1.0 strict validated, uses CSS)
  • Secured against spam bots and attacks
  • Easy to customize
  • Hosted on your own web server
  • Free!

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. $formproc->AddRecipient('name@your-website.com'); //<<---Put your email address here
    
  4. Upload the folder contents to your website (to a sub-folder say, /contact)
  5. The contactform.php contains the form. You can link to this file or embed the form using iframe.
  6. Here is 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

You can edit the contact.css file to change the style of the form. You can add any type of fields to the form. The fields will automatically be included in the form submission emails.

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.

Be Sociable, Share!
Lun January 4, 2012 at 10:17 am

Hi the code works very well except when i put my email address at me@titieco.com.my, it doesnt work anymore, works with me@gmail.com. can you tell me how to fix this problem? thank you so much!

Luisa Galan January 18, 2012 at 11:43 pm

Thanks a lot!! works perfectly!

Aaron January 28, 2012 at 10:22 pm

Hi there, it looks great! BUT….I placed it on my site using iFrame, but the hidden field on top meant for bots appears. How do I hide it? Thanks!

Tom February 2, 2012 at 9:18 pm

Hi,

great form, thanks!

techaleart February 21, 2012 at 6:29 am

hi, this code is very simple and any one can try it. thnks…..

:).. thnks.. codeR.

Madeline March 3, 2012 at 3:10 am

Thank you for this piece of code! Very easy to implement. However, it doesn’t seem to want to send any emails. I have my email hosted by google rather than by my webspace or domain host. Could that be the problem? Thanks.

omar March 11, 2012 at 5:46 pm

Form not submitting…Please help. When I click on submit button nothing happens :(

Una March 14, 2012 at 7:41 pm

thank you so much for this form…. i can see a lot of work gone into it..much appreciated…
But why does it keep failing the anti spam question…
No matter what anyone types in, it throws back the message
“failed anti spam check”

Anyone have any ideas on why this is happening OR how to fix it?

Una March 14, 2012 at 7:41 pm

the anit spam question keeps failing.
anyone know why?

thanks so much

Comments on this entry are closed.

Previous post:

Next post: