Php Contact Form With Validation Free Download

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.

  1. Free Php Contact Form Script
  2. Php Contact Form With Validation free download. software
  3. Php Contact Form With Validation Free Download Pdf
  4. Free Contact Form Php
  5. Php Contact Form With Validation free. download full
Note:

A complete tutorial for building a PHP email contact form using AJAX. Working code examples and a free download to use on your own website. Simple AJAX PHP Email Form with Validation. Download the free AJAX PHP email form. If you'd rather not go through this tutorial to build your own PHP feedback form, you can download the demo instead.

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.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 a 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 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

Click here to download php-email-contact-form.zip

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

More Contact forms:

  • A simple, easy PHP contact form
  • A popup contact form
  • A contact form with file upload support

No related posts.

Comments on this entry are closed.Previous CommentsvagelisDecember 20, 2011, 2:47 pm

hello, i did exactly what you have written and when I use wamp I complete the form and send it, it looks like the information has been sent to my e-mail.it shows the message thank you etc,but I have no mail in my account.

will make sure that the email field is in the format: name@domain.tld.

is there anything i can do about this?

thank you, sorry about my english.

RachelDecember 27, 2011, 8:28 pm

I made a new folder called “contact” where I placed all the files and put the ‘contact-form.html’ code on my contact.html page.

Now whenever I submit the message, the “contact-form-handler.php” starts to download and does not send an email.

Please help! THank you!

PrasanthDecember 28, 2011, 2:56 pm

your web server does not support PHP

MayurJanuary 7, 2012, 9:23 am

1) { $boundary = uniqueid(“EWSEWS”); $headers.=”Content-Type:multipart/mixed”. “; boundary = $boundaryrnrn”. “This is a MIME Encoded message.rnrn”. “–$boundary”; foreach($attachment as $att) { $headers.=”rn”. do_Attachment($att). “–$boundary”; } $headers. = “–rn”; } else { $headers.=”do_Attachment($attachment[0])”; }

Patricia BaileyJanuary 7, 2012, 1:23 am

I downloaded the code for the contact form

“Click here to download php-email-contact-form.zip” above.

I designed a contact_us.html, contactform.php., contact.css, thank-you.php, class.phpmailer.php, fgcontactform.php, gen_validatorv31.js, and it is not working yet.

What am I missing?

OmsoftechJanuary 7, 2012, 6:27 pm

Thanks for giving us…

amithJanuary 30, 2012, 5:45 am

Hi when i click submit .. Php codes are coming in the browser . why the process is not happening???? me new to php.
reply soon
thx

KennethJanuary 30, 2012, 8:17 am

I did what had to be done including downloading the source code; how do i get the message into my e-mail account just to test the code works.

DinJanuary 30, 2012, 10:21 pm

Thank you for this helpful guide. PHP is quite hard for me to understand!

MustufaFebruary 9, 2012, 5:34 pm

Free Php Contact Form Script

Whenever i click on submit button php page start downloading i am using drop box as a hosting server plz reply

TimFebruary 10, 2012, 6:13 pm

i keep getting the following error message:
“Error: couldnot get Form object contactform”

this makes no sense to me. i copied everything exactly from another website i used this form on. the original site works fine, but the new site keep giving me this error

TimPhp Contact Form With Validation Free DownloadFebruary 10, 2012, 6:28 pm

Php Contact Form With Validation free download. software

ok so i managed to get rid of the error message but im still not receiving the emails

VictorMarch 19, 2012, 5:19 am

Tim, I am receiving the same message. How did you resolve yours?

KevinFebruary 23, 2012, 2:51 pm

Thanks for the great form, is there any way I can change the colours etc of the email it sends to me?

Thanks

Son TranducFebruary 27, 2012, 3:17 pm

Beside the webserver with php supported, Do I need a mail server to make this work?

Thanks
Son Tranduc

SeemaFebruary 29, 2012, 6:54 am

Hi,

Thanks for great tutorials. Its work fine.
Can you please help me for how can user receive the thank you message on there mail.

Thanks
Seema

MarziaMarch 2, 2012, 8:40 pm

Hi, it works perfectly apart one thing. I added extra fields for my needs but the javascript alert (if empty) works only in the first two input fields. How is it possibile to make the alert working on all of them?
here’s my form:
http://www.magadesign.co.uk/php-email-contact-form-LASER/contact-form.html
Thanks if anyone can help!!
Marzia

pramod yadavMarch 5, 2012, 2:24 pm

sir…
the above code is running ”’
but i get thank uuuu messs…
no getting the email to the desired email addresss///

please reply ”’
its urgent

Php Contact Form With Validation Free Download Pdf

MarziaMarch 8, 2012, 12:14 pm

well, my comment still awaiting moderation..but there’s not need anymore. I coudn’t see a very stupid error in my third field, which was affecting the functioning of the js in all following fields. Now it’w working perfectly and I even managed to put a radiobutton!!

ajayMarch 12, 2012, 12:28 pm

i m not getting any msg ..in my email account .//
i do as u tell but still not proper responce.//

WebsterMarch 20, 2012, 5:48 pm

Awsome tut, thanks worked as intended! Now I can finally finish my college project: http://www.cavanplumber.com !

Previous Comments

PHP is a great scripting language that allows many dynamic functions in your site. You can create custom contact forms, form validation, and email responses using PHP. This article will explain the basics in creating an email form that validates the inputs, produces errors when inputs are typed incorrectly, and send an email to you when submitted.

This section of the code will validate the form inputs

Below is the code you will use to validate whether the inputs have valid data or not. This can be customized for different form field validations.

Note! You can paste the entire code directly in the body section of your webpage to get it working.

Sends the email if validation passes

The following code is what sends the email. The inputs must pass the previous validation in order for the email to send. You will need to replace the “to” email address with the email address you want to receive the email to.

Free Contact Form Php

Error Reporting Code

Prints the contact form

This is the form that will display for the visitor to fill out.

Php Contact Form With Validation free. download full

You can paste the entire code directly in the body section of your webpage to get it working. We have more tutorials with other methods to send email from your website at the following links.