How to create an ajax based contact form
Recently by working on a theme i needed to built an ajax based contact form. Here is a trimmed version of that contact form script. Although, it's an trimmed version it's working perfect. You can even use it in your application by making necessary changes according to your need.



This contact form works by using following steps..



Ajax base contact form



Step-1 : Javascript validate all the user entered information at client side. If found any error it'll show error on the HTML form.



Step-2 : If client side validation is found "OK" it's send the data to the server side PHP script file(process.php) by using "jquery.ajax()" method.



Step-3 : At "process.php" file all the received data are checked once again. According to the status of the received data there are some php variable get set by some status message("ok" or "blank") & return to "jquery.ajax()" method by JSON format.



Step-4 : By, checking the status message "jquery.ajax()" method shows appropriate message(message sending success or failed) to user. If all the received JSON data message is found "OK" then Success message will appear else respective error will appear on the form.





How to use this script

* Insert all the database details at "database_config.php".

* Create table for storing contact information. The SQL query for creating table has given in the download files.

* If want to customize the jquery validation you can get more info from http://goo.gl/Ret4



Download files : http://www.box.net/shared/h9o2ai2ooh



NOTE

This contact form use following open source tools..

Jquery plugin for client side form validation : http://bassistance.de/jquery-plugins/jquery-plugin-validation/

Captcha : http://www.captcha.fr/

5th Jun 2011 at 6:23 PM   1575 Views

Oop's, No Comments has been droped for this thread yet now.
Why don't you drop one.