AJAX Form with CAPTCHA, Realtime Validation and PHP Backend

The aim of this basic tutorial is to help you to create a simple (table-less) AJAX Contact Form using jQuery & PHP. It will give you an idea of how you can create similar web applications using jQuery and AJAX. We will have a HTML page which will contain the form, a CSS file, a .PHP page where the data will be sent and another file where the validation function(s) will be located.

Step 1 – Creating the configuration file


// To
define("WEBMASTER_EMAIL", "your_name@your-domain.com");

Here you should fill the e-mail address where you wish to receive the mail as well as the address where you wish to receive the replies (usually the same).

Step 2 – Creating the css file


Credits: Bit Repository
CSS Library: http://www.bitrepository.com/

html, body  { padding: 0; border: 0px none; }

.notification_error {
	border: 1px solid #A25965;
	height: auto;
	width: 90%;
	padding: 4px;
	background: #F8F0F1;
	text-align: left;
	-moz-border-radius: 5px;

.notification_ok {
	border: 1px #567397 solid;
	height: auto;
	width: 90%
	padding: 8px;
	background: #f5f9fd;
	text-align: center;
	-moz-border-radius: 5px;

.info_fieldset { -moz-border-radius: 7px; border: 1px #dddddd solid; }

.info_fieldset legend {
	border: 1px #dddddd solid;
	color: black; 

	font: 13px Verdana;

	padding: 2px 5px 2px 5px;
	-moz-border-radius: 3px;

.button {
	border: 1px solid #999999;
	border-top-color: #CCCCCC;
	border-left-color: #CCCCCC; 

	background: white;

	color: #333333; 

	font: 11px Verdana, Helvetica, Arial, sans-serif;

	-moz-border-radius: 3px;

/* Label */
label {width: 140px; padding-left: 20px; margin: 5px; float: left; text-align: left;}

/* Input, Textarea */
input, textarea {
	margin: 5px;
	padding: 0px;
	float: left;

	border: 1px solid #999999;
	border-top-color: #CCCCCC;
	border-left-color: #CCCCCC; 

	color: #333333; 

	font: 11px Verdana, Helvetica, Arial, sans-serif;

	-moz-border-radius: 3px;

/* BR */

br { clear: left; }

Step 3 – Creating the HTML Contact Page

This is the page where the AJAX call to contact.php is made. I will explain you the JavaScript Code in detail below:


	<title>TableLess Ajax Contact Form (Demo)</title>
	<meta name="Keywords" content="form, divs">

	<meta name="Description" content="A CSS Tableless Ajax Contact Form">
	 <!-- jQuery -->
	 <script type="text/javascript" src="jquery-1.2.6.min.js"></script>
	 <script type="text/javascript">
	 // we will add our javascript code here           
	 jQuery(document).ready(function($) {

		$("#ajax-contact-form").submit(function() {
			// 'this' refers to the current submitted form
			var str = $(this).serialize();
			   type: "POST",
			   url: "contact.php",
			   data: str,
		   	   success: function(msg) {	 
					// Message Sent? Show the 'Thank You' message and hide the form 
					if(msg == 'OK')
						result = '<div class="notification_ok">Your message has been sent. Thank you!</div>';
					} else {
						result = msg;

			return false;
	<link rel="stylesheet" type="text/css" href="style.css" />
 	<div align="center">
		<h3>A Tableless Contact Form (jQuery &amp; AJAX)</h3>
		<div align="left" style="width: 500px;">
		<fieldset class="info_fieldset"><legend>Contact</legend>
		<div id="note"></div>
		<div id="fields">
		<form id="ajax-contact-form" action="">
			<label>Name</label><input class="textbox" type="text" name="name" value=""><br />
			<label>E-Mail</label><input class="textbox" type="text" name="email" value=""><br />
			<label>Subject</label><input class="textbox" type="text" name="subject" value=""><br />
			<label>Comments</label><textarea class="textbox" NAME="message" ROWS="5" COLS="25"></textarea><br />
			<label>&nbsp;</label><input class="button" type="submit" name="submit" value="Send Message">

Ajax Contact Form - Show Errors

Once the DOM is loaded (we determine this by using jQuery(document).ready($)), the script checks if the user submitted the form by using $(“form”).submit(). If it is, the form elements (names & values) are serialized in order to pass them to the AJAX Call:

var str = $("form").serialize();

$.ajax() takes one argument, an object of key/value pairs, that are used to initalize and handle the request, and returns the XMLHttpRequest object for post-processing (like manual aborting) if needed.

Some options are used to control the behaviour of $.ajax. The information is from JQuery Documentation:

(String) type – This is to determine the type of request that is made: ‘POST’ or ‘GET’. (default is ‘GET’)
(String) url – The URL to request
(Object|String) data – Data to be sent to the server. It is converted to a query string, if not already a string. Is appended to the url for GET-requests. See processData option to prevent this automatic processing.
(Function) success – A function to be called if the request succeeds. The function gets passed one argument: The data returned from the server, formatted according to the ‘dataType’ parameter.

To find out more about $.ajax consider visiting http://docs.jquery.com/API/1.1/AJAX.

The request succeded? In this case we will call the ajaxComplete(callback) function, which executes whenever an AJAX request is completed. The XMLHttpRequest and settings used for that request are passed as arguments to the callback.

I recommend you using the Firefox Extension Firebug, a popular and powerful web development tool. It adds a global variable named “console” to all web pages loaded in Firefox. This object contains many methods that allow you to write to the Firebug console to expose information that is flowing through your scripts. While executing AJAX Code you can check the console to see how the data is sent to the remote files, in this case parse.php.

Capture from the Firebug Console

If ‘OK’ is returned the form hides and a thank you message is shown. If any other text is shown (beside ‘OK’), then there are errors and they will be shown above the form.

			   type: "POST",
			   url: "contact.php",
			   data: str,
		   	   success: function(msg) {	 
					// Message Sent? Show the 'Thank You' message and hide the form 
					if(msg == 'OK')
						result = '<div class="notification_ok">Your message has been sent. Thank you!</div>';
					} else {
						result = msg;


Ajax Contact Form - Message Sent

In the next page of our tutorial we will create: functions.php (which has the e-mail address validator) and contact.php (which is the script that parses the submitted data).

Step 4 – Creating the functions’ script.


function ValidateEmail($email) {
	(Name) Letters, Numbers, Dots, Hyphens and Underscores
	(@ sign)
	(Domain) (with possible subdomain(s) ).
	Contains only letters, numbers, dots and hyphens (up to 255 characters)
	(. sign)
	(Extension) Letters only (up to 10 (can be increased in the future) characters)
	$regex = '/([a-z0-9_.-] )'. # name
	'@'. # at
	'([a-z0-9.-] ){1,255}'. # domain & possibly subdomains
	'.'. # period
	"([a-z] ){2,10}/i"; # domain extension 
	if($email == '') {
	    return false;
	else {
		$eregi = preg_replace($regex, '', $email);
	return empty($eregi) ? true : false;

This file contains only the e-mail address validator, in our sample, but you can use it to add more (validation) functions which can be used in the contact.php page.

Step 5 – Creating the page which parses the data


Credits: Bit Repository
URL: http://www.bitrepository.com/a-simple-ajax-contact-form-with-php-validation.html
include 'config.php';
error_reporting (E_ALL ^ E_NOTICE);
$post = (!empty($_POST)) ? true : false;
if($post) {
	include 'functions.php';
	$name = stripslashes($_POST['name']);
	$email = $_POST['email'];
	$subject = stripslashes($_POST['subject']);
	$message = stripslashes($_POST['message']);
	$error = '';
	// Check name 
	if(!$name) {
		$error .= 'Please enter your name.';
	// Check email
	if(!$email) {
		$error .= 'Please enter an e-mail address.';
	if($email && !ValidateEmail($email)) {
	    $error .= 'Please enter a valid e-mail address.';
	// Check message (length)
	if(!$message || strlen($message) < 15) {
	    $error .= "Please enter your message. It should have at least 15 characters.";
	if(!$error) {
		$mail = mail(WEBMASTER_EMAIL, $subject, $message,
		     "From: ".$name." <".$email.">rn"
		    ."Reply-To: ".$email."rn"
		    ."X-Mailer: PHP/" . phpversion());
		if($mail) {
			echo 'OK';
	} else {
		echo '<div class="notification_error">'.$error.'</div>';

In contact.php, we have to determine first if a POST request was sent to the file. If $post is not null, the functions.php file is included (containing the e-mail validator) and the POST fields are declared. Each required field is checked. If any error is found, the $error variable will be filled with that error message. At the end, if $error is null (as it was initially) & the mail is sent, contact.php will output ‘OK’ (which is checked in contact.html). It is is not null, contact.php will output the error(s), which will be shown, of course, in contact.html.

Get Basic

This version contains the basic features that were discussed in the tutorial.
Download | View Demo

Get Advanced

This is an advanced AJAX Contact Form builder that can be used to built a custom contact form. It’s a free and very light version of AJAX Form Pro, my premium form builder. This version is available for BitRepository.com subscribers. Type your details below, confirm your email and you will receive the download link in your inbox.


Get Premium

AJAX Form Pro is a premium Multi-usage AJAX Form builder with lots of features and support for all form elements. Starts from $13.95.

Customer Testimonials

“Very nice! We went through 8 different scripts, only to be frustrated with broken code, links, and tutorials, to finally find one so simple, beautiful and it works! We are avid PHP programmers, but are not yet too versed with AJAX, so this solution was perfect! Thanks”Jared (http://www.haroldsmithbicycle.com/)

“I had a real need for a clean and stylish contact form. I tried some 11 forms before I decided on one. I have to say your form was the winning choice hands down.”Kevin Morrison (NW Interactive designs)

“It works very good and it solved the problem of needing a form validation as well a as a success message in the same page.”Rolando Martinez Barron (http://www.matamoros.com/)

“I am working a project for patisserie web site in Turkey and i used your form form this web site contact page. Belong to me, your form is very useful and successful, thanks a lot.”Kayhan Yalinkilic

Comment via Facebook



  1. GabrielGabriel says

    Yes, it would be, but the script has the mail() function which can be used abusively (i.e. SPAM). If a demo will be made, it must have some protection.

  2. Array says

    Thank you very much for your Tutorial. But it has a small Validation error in e-mail field.

    i mention comma in the above Email address.. But it doesent validate your code..

    plz check and correct it..

    Thank you

  3. Jamie says

    How might I get this to put the user’s email into the “from” field properly so that a REPLY goes back to them instead of to me? In my use, this would be considerably more useful. I’ve tried putting $from and $email into the config file, but that doesn’t do it. I don’t know enough about PHP yet.

  4. Alex says


    Awesome site, thanks so much!

    I’m using your script for an email sign up form. How would I go about forcing an email subject when the user doesn’t have the option of entering a subject.

    Thank you so much :)

  5. GabrielGabriel says

    If you don’t need a subject from the person filling the form & want to set a specific subject you can do the following:

    1. Remove line 76 from the form (the one with the subject)

    <label>Subject</label><INPUT class="textbox" type="text" name="subject" value=""><br />

    2. Remove line 19 from contact.php

    $subject = stripslashes($_POST['subject']);

    3. Change $subject from line 58 (where you have the mail function) with ‘your subject here’.

  6. says

    hi webmaster, i have downloaded your script but its not working
    nothing is happening when i click on submit button
    iam using php4 and testing under localhost do i need to change any code if any please post me
    thank u

  7. says

    Great! That modification worked without a problem.

    Now, I’d like for the person’s name to be put in the From: field properly. They’re typing their name into the form, but I don’t receive it. I did replace $from with $name (I forget where) and it puts it into the proper field… but, it appends @mydomain.com after it. Other than that, this script does exactly what I needed with a minimum of hassle. Thanks a lot!

  8. Garry says


    This is great website, keep it up :)

    I’m just wondering how I would go ahead and force a sentence such as “The following email would like to sign up to the Newsletter” in the body of an email?

    Also is it possible to have a checkbox submit a true or false?

    Starting to get more in PHP coding… sites like theses are a great help. If there’s anyway I can donate some money for your help, please let me know :)


  9. GabrielGabriel says


    Thank you for your comments regarding this website. Let’s add the checkbox first.

    1. Here’s the code that should be inserted in contact.html:

    <label>Sign up to Newsletter</label><input type="checkbox" name="newsletter_signup"><br />

    I recommend you to add it just AFTER:

    <label>Comments</label><TEXTAREA class="textbox" NAME="message" ROWS="5" COLS="25"></TEXTAREA><br />

    2. Now, we have to edit contact.php. AFTER:

    $message = htmlspecialchars($_POST['message']);

    add the following line:

    $newsletter_signup = $_POST['newsletter_signup'];

    3. We will make the final modifications.

    Look for:

    $mail = mail(WEBMASTER_EMAIL, $subject, $message,
         "From: ".$name." <".$email.">\r\n"
        ."Reply-To: ".$email."\r\n"
        ."X-Mailer: PHP/" . phpversion());

    Just BEFORE it add the following code:

      $message .= "\n\n"."[The following email would like to sign up to the Newsletter.]"; 

    Notice how I used the string concatenation to add additional text to the message.

    I hope you will manage to successfully implement the code I gave you. If you have any questions, let me know.

    If you’d like to make a donation, you can look for a PayPal button located just above the pagination links for this tutorial.

  10. Cody says

    Thank you for this great form.

    How would you change the submit button so when a user clicks on it, it changes to something like ‘Submitting Form, please wait…” With the dots animated.

  11. GabrielGabriel says

    This form submits fast enough and a loader (until you the script gets a response from ‘contact.php’) is not really needed. However, it can be useful if the user has a slow bandwidth connection. Here’s how you can add one:

    1. AFTER:

    <INPUT class="button" type="submit" name="submit" value="Send Message">

    ADD the following div:

    <div id="loading"></div>

    2. AFTER:


    ADD the following code:


    This way the submit button is hided and the loader is shown.

    3. BEFORE:




    The loader is hided and the submit button is restored.

    As for the dots you can use an animated GIF:

    $("#loading").html('Submitting Form, please wait <img src="path/to/dots.gif" align="absmiddle">');
  12. GabrielGabriel says

    Sure, here’s what you have to do:

    1. Replace the following line from the contact.html page:

    <label>Name</label><INPUT class="textbox" type="text" name="name" value=""><br />

    WITH this code::

    <label>Company</label><INPUT class="textbox" type="text" name="company" value=""><br />
    <label>First Name</label><INPUT class="textbox" type="text" name="first_name" value=""><br />
    <label>Last Name</label><INPUT class="textbox" type="text" name="last_name" value=""><br />

    2. Now, you have to edit contact.php. Find this line:

    $name = stripslashes($_POST['name']);

    Replace it with:

    $company = stripslashes($_POST['company']);
    $first_name = stripslashes($_POST['first_name']);
    $last_name = stripslashes($_POST['last_name']);



    AFTER it, ADD:

    $subject = $company.': '.$first_name.', '.$last_name.' - '.$subject;

    3. Let’s add some validation to the new fields! Find:

    // Check name
    $error .= 'Please enter your name.';  

    Replace it with:

    // Check first name
    $error .= 'Please enter your first name.';  
    // Check last name
    $error .= 'Please enter your last name.';  
    // Check company
    $error .= 'Please enter your company name.';

    To make a field optional, remove the conditional IF that verifies it.

  13. says

    Great tutorial! I was wondering if i could send additional information to the email, for example i have a field called “Company” and would like it to be in front of the subject (along with the first- and last name).

  14. GabrielGabriel says

    Do you want to replace the “name” field with 2 fields (first & last name) and to add an additional field called “company”? Would the subject be something like: “Company Name: First Name, Last Name”?

  15. Pari says


    I just tried it on my website and it seems to be working fine but I am not getting any email :( I have been waiting for the last 30 minutes now. I added my email twice in the config file, is there anyplace else where I need to add it? I had to copy paste the codes into files because my zip extractor wont open the zipped file downloaded from here either :(

  16. says

    For some reason when I am using this on my site, when I press ‘Submit’, js alert window comes up saying ‘success!’. But doesn’t do anything after. Also if I remove the [HTML STRIPPED] line it still does nothing.

  17. GabrielGabriel says

    @Travis O'Donnell: After checking the contact form that you installed in your site, I've noticed that jquery-1.2.6.js is not loaded. Are you sure the file is in the main root of your site? I've tried to open it but I got an error.

    • says


      Im having the same problem. even without anything type in the form, when I click submit a window pops up with “success” nothing is validated or nothing, no error messages…

      Plz help

      • Gabriel C.Gabriel C. says

        @anthony, this issue was already discussed. As I mentioned before, you just did not do something right (the JQuery library is not included, the ID of the form is not the right one etc.). Just check the older comments and hopefully you will find the answer. If you want to me setup the form on your website I would do it if you are willing to pay a fee.

  18. says

    Thanks for helping me earlier on with the subject field. I was wondering how i could send a overview of all the fields in the email, like:
    – Company:
    – First name:
    – Last name:

    Hope you can help me out with this one!


  19. GabrielGabriel says

    You need to modify $message. Example:

    $message = "- Company". $company."\n- First name: ".$first_name."\n- Last name: ".$last_name."\n\n".$message;

    • Brian says

      Which file do we edit this on? contact.php or feedback.php?

      That string ” $message ” exists in many spots in different files.

      Thanks much for your help!

      • Gabriel C.Gabriel C. says

        In contact.php: add the code after if(!$error) { (just before the mail() function is called). The file feedback.php was just used for demo purposes to demonstrate how you can add more AJAX Forms in the same page.

  20. GabrielGabriel says

    This has nothing to do with the script, which is working fine. It's probably a problem with the software that is installed on your server and sends the mails. Did you use mail() before in other scripts? Did it work? Also, make sure that you didn't change the original script and you typed the correct e-mail address in the config.php file.

  21. Madiha says

    This is amazing, just what I needed!! Great job! I had a question… What if I have two forms on my site? One for comments and one for ordering. How can I modify the script so it will work with two different forms with different fields?

    Thanks so much!

  22. GabrielGabriel says

    Madiha, good question! I have updated the ZIP file. If you download it, you will find a page sample with 2 forms in the same html page (multiple_forms.html). I will also update this tutorial with an explanation of how you can use more then 1 form in a page.

  23. Madiha says

    Hi sorry but the zip file does not work, it says there are 0 files in the folder…can you please check for me, I am pretty sure its empty…

    Thank you so much for ur help!

  24. GabrielGabriel says

    I've just downloaded the ZIP file (21,1 KB) and extracted it successfully. What software are you using to extract the ZIP archive?

  25. Madiha says

    Hi, I am using Z-Zip and I also installed Winzip and winzip error is saying "File corrupt, possible transfer error…"


  26. Madiha says

    Thanks alot! It worked great!! This is the best form out there!

    I had a quick question about an answer that you posted for somebody here…

    The Question was, How do we add Company name, First name, Last name to the email we recieve inside the body of the email?

    And you said:

    You need to modify $message. Example:

    $message = "- Company". $company."\n- First name: ".$first_name."\n- Last name: ".$last_name."\n\n".$message;

    But in my contact.php file, I have this info already placed there:

    "$message = htmlspecialchars($_POST['message']);"

    How do I add that new line in?

    Thank you for all your help!

    • GabrielGabriel says

      Yes, before the line with the mail function add:

      $message = "- Company". $company."\n- First name: ".$first_name."\n- Last name: ".$last_name."\n\n".$message;

      This way, you will have company, first & last name before the actual message. Notice how I used string concatenation in this situation.

  27. Madiha says

    Hi, thank you that worked!

    But now, it wont validate if a message was input and if it was less than 15 char..

    It wont give me an error if i enter NO message…


  28. GabrielGabriel says

    Did you remove $message = htmlspecialchars($_POST['message']); ? I said that you should add that new line before the call to mail() function. I don't know how you modified contact.php. The validation should work 100%!

  29. Madiha says

    This is what I have:

    $message = "- Name: ".$name."\n- Phone: ".$phone."\n\n".$message; htmlspecialchars($_POST['message']);

  30. GabrielGabriel says

    No, that is wrong! I told you to add the new line before the call to mail() (just after if(!$error) ) without any other changes.

  31. Jasper says

    That's great! The strange is though i don't see the actual "message".
    I do see company, firstname, lastname. What am i doing wrong?

  32. Ted says

    Thank you very much for a clean and thorough presentation!

    Just wanted to note I had to change (in contact.php – Line 20):

    $message = htmlspecialchars($_POST['message']);


    $message = stripslashes(htmlspecialchars($_POST['message']));

    because, for example: "user's typed message" was sending me: "user\'s typed message". I don't know if it is my server's PHP settings (which are default from my provider) or what, but I had to add stripslashes to the $message line, now I am good.

  33. GabrielGabriel says

    Yes, you did good. I just omitted to add it for "message", as I did for "name" and "subject". Will update the post!

  34. Jasper says

    This is what i have:

    <select name="aanhef" id="aanhef">
    <option value="De heer">Man</option>
    <option value="Mevrouw">Vrouw</option>

    And i can't send the form because the select field is empty.
    Can you please help me out?

  35. GabrielGabriel says

    @Jasper: That dropdown ("aanher") doesn't really need a validator because there are only 2 options in it and none of it is NULL.

  36. GabrielGabriel says

    Yes, you can either use CC or call again mail():

    $mail = mail(WEBMASTER_EMAIL, $subject, $message,
    "From: ".$name." <".$email.">\r\n"
    ."Reply-To: ".$email."\r\n"
    ."X-Mailer: PHP/" . phpversion());

    $mail_two = mail('[email protected]', $subject, $message,
    "From: ".$name." <".$email.">\r\n"
    ."Reply-To: ".$email."\r\n"
    ."X-Mailer: PHP/" . phpversion());

    I do not recommend adding new email address separated by commas in the config.php. Everyone who receives the mail will see all the addresses where the mail was sent and in many cases this is not recommended at all.

  37. Ted says


    I've been running this past a page with other Ajax calls, and once msg=='OK', the .ajaxComplete reacts to the successful completions of the other, unrelated Ajax events.

    So, in contact.html:

    27 $("#note").ajaxComplete(function(event, request, settings){
    39 $(this).html(result);

    …do you see any problem with eliminating line 27 and changing line 39 to this?:

    39 $("#note").html(result);

    Just curious, because I made that change and everything is still working in what I've checked: Safari 3.x, FF3, and IE7.

  38. Jasper says

    Oke that's cool. So can i send the second mail to the person who filled in the form? I'm not sure how to edit this:
    $mail_two = mail('[email protected]', $subject, $message,

    Is it something like this?
    $mail_two = mail(". $email.", $subject, $message,

    Hope you can help me!

    • GabrielGabriel says

      @Jasper: To send a mail to the person who filled the form consider using the following code:

      $mail_two = mail($email, $subject, $message,
      "From: your_name < ".WEBMASTER_EMAIL.">\r\n"
      ."Reply-To: ".WEBMASTER_EMAIL."\r\n"
      ."X-Mailer: PHP/" . phpversion());
  39. says


    i add succesfull your ajax form to my website but i have 2 issues

    1 html specialchars are not suportet when i receive a mail it remove all special chars like àáâãäçèéêëìíñòóôõö how i can solve this

    2 the second is in the emails is nothing like name phone adress ect

    this 2 issues also dont work in your downloadarchive i test it can you help me please thank you

  40. says

    i fixed by myself and add few functions

    captcha enable disable in config.php
    additional fields enable disable in config.php
    autoresponder defne text in contact.php
    add body text for received emails
    fix for suport html special chars is working now
    adress ect.
    ALL THIS CHANGES only for the contact formular not for the feedback
    download here http://www.jobadoo.us/contact_form1.rar

  41. Jasper says

    In the second email i don't want the same information as the first email.
    The second email is sent to the person who fills in the form and should therefore contain a text message instead of all the filled in information.
    But i'm not sure how to do this.

    $mail_two = mail($email, $subject, $message,

    so the field $message should be replaced with a text.

  42. joe says

    i followed the steps correctly (or at least i think i did)

    it looks good up till the end, when you click the submit button, this error appears above

    \r\n" ."Reply-To: ".$email."\r\n" ."X-Mailer: PHP/" . phpversion()); if($mail) { echo 'OK'; } } else { echo '

  43. says

    Excellent facility! I'm using AJAX contact forms for over 2 years, but I would like to either integrate JQuery within my current version or use other solutions like this one.

    A bug I've discovered with your solution is that it reports some legitimate email addresses like invalid ones

    For instance, my email address ends in [at] pro-it-service.com

    The script seems to not recognize the dashes from the domain name…

    Kind Regards,
    Mihai Bocsaru

  44. says

    I guess you've updated it on your end, but didn't update it online as well or on the downloadable archive… I've just looked at the coding from this page and inside the archive and the email validating function is the same…

    • GabrielGabriel says

      I did update it online (tutorial & demo). I've also updated the ZIP archive. It should work now. I will re-upload the files again.

  45. says

    Great, thank you! I've just discovered now that it is not compatible with Lightbox2 from http://www.lokeshdhakar.com/projects/lightbox2/

    In case you place the lightbox 3 js calls before your ajax form js coding, then the ajax form will work, but the lightbox not and vice versa…

    If you have the 3 lightbox js files referenced after the js coding for your ajax form, then the lightbox effect will work, but not your form AJAX effect…

    Can you please try, see and fix that?


  46. says

    Actually, I've thought about having both features on the same technology and so I've searched for Lightbox based on jQuery.

    After some testing the best solution for me is http://plugins.jquery.com/project/jquerylightbox_bal because I could keep referencing images where I want the lightbox effect with rel="lightbox" 😉

    So folks, if you want to operate Lightbox and this awesome ajax form, consider http://plugins.jquery.com/project/jquerylightbox_bal instead of http://www.lokeshdhakar.com/projects/lightbox2/

    I've used Lokesh Lightbox2 solution for 2 years, but it's now time to switch over to jQuery

  47. IASIIS says

    Hello. Amazing tutorial and amazing webmaster response here!

    I’m a novice and have probably what is a basic question. Why this html code is included:

    69. <div id="note"></div>
    70. <div id="fields">

    Because I do not see the ids #note and #fields in the CSS code.

    Later :)

    • GabrielGabriel says

      The ID attribute is used to assign a unique identifier to an element. For instance “note” is assigned to a DIV where the submit status is shown (errors or message sent). If you study the JavaScript code you will see how ‘#note’ is used.

  48. TommyB says

    Gabriel, awsome tutorial. I used your method on a site over the weekend and it is working well, so thank you. Just a thought/question…Would it be worth validating the form fields with jQuery as well as in the php file? That way the data will be validated even quicker. Let me know your thoughts.


  49. IASIIS says

    Ahh yes. With out that code it will not print out the Ok and Error messages. Thank you for your help Gabriel.

  50. IASIIS says

    There are 3 error messages that can be displayed. I want to have a different div for each of the messages instead of the one “.notification_error” div. I would need:

    – .notification_name_error
    – .notification_email_error
    – .notification_message_error

    how would I go about programming the java to allow this to occur?

    Also have another question for you.

    also, lets say that someone screws up all 3 required fields and gets all 3 errors. I would like these errors to be displayed in their individual rectangular sausage shaped divs starting with

    1) “.notification_name_error” at the top place
    2) “.notification_email_error” in the middle
    3) “.notification_message_error” on the bottom

    What if someone only screws up the email and the message fields. In that case I would want the “.notification_email_error” and “.notification_message_error” divs to appear but I would want the “.notification_email_error” div to appear in the top placement just like the “.notification_name_error” div in Scenario 1. The “.notification_message_error” div would appear in the 2nd, or middle, placement just like the “.notification_email_error” div in Scenario 1.

    If someone screws up just the message field then I would want the “.notification_message_error” to appear in the top placement just like the “.notification_name_error” div in Scenario 1.

    How would one go about programming the java to attain this result?

    Thanks again Gabriel,

    • GabrielGabriel says

      What you want is something quite different than what you currently have. First, you need to add the DIVs (with no text inside them) in the form (top, middle, bottom), each having a unique ID and the style set to ‘display: none’. You also need to change the contact.php file to send the response in JSON format. The JavaScript receives the data from contact.php and checks (for instance) if the email error notification exists. If the ’email’ object exists, then set the notification_email_error to “visible” mode and fill the text error in it. I don’t know how familiar you are with PHP, JQuery and JSON but here are some URLs that can help you:

      http://docs.jquery.com/Events (JavaScript Events)
      http://docs.jquery.com/Selectors (JQuery Selectors)

  51. says

    Thanks for this great script.
    I’ve implemented on a site that has more fields (12 in total), Name, Telephone and Email are required and the rest are not.
    The problem appears when I complete only one field(and the error appears), then I complete the rest of the required fields but the submit button is disabled(doesn’t function anymore)
    Also the email and telephone insert validation doesn’t seems to be working in my multiple field form(the same check functions gives me error as the field is not completed when in fact it is completed!
    Any ideas? Thanks

  52. easy rebel says

    Hey, thanks a lot for this. I’ve been learning a lot about jQuery lately, and this was great.

    I’m running into a problem with this however. Everything works fine except that when the message sends/returns successfully. The only thing that doesn’t is the success message.

    The success message doesn’t appear and the fields div doesn’t get removed after a successful submission. It seems to just skip to the next code block in the javascript and returns/prints the ‘OK’ result from the php script instead of reading it correctly and changing content.

    I was using jQuery 1.3.1, then switched to 1.2.6 just to see if that was the issue and I ran into the same problem.

    Any help would be appreciated. Thanks!

  53. says

    Hi thanks for the form, this is the first time adding this to a site. I have an issue however, when i click submit all that happens is that instead of contact (at the top of the form) i get “OK” displayed and all the data in the form remains. Maybe i have done something wrong?


    • GabrielGabriel says

      I think you have modified contact.php. Did you add HTML code in it? The only thing that should be outputted from contact.php is “OK” (if successful).

  54. easy rebel says

    Gab, thanks for the response. Yes, I changed some code in the contact.php file because I needed to make some changes to integrate into my own setup. Nothing major. I’ve looked it over multiple times and didn’t see anything that could be causing an issue like this.

    I did download the tutorial files and try them and they worked fine. Looking over those and this tutorial, there are a few differences in some of the coding. So, I’m going to use the downloaded files as a guide to redo some things and see if I can fix this.

  55. easy rebel says

    Ok, I’ve narrowed things down to the only thing that can be causing this issue.


    There’s an issue with the Smarty templating system and your script that I need to figure out. If I take the success from the javascript and use that as the echo string instead of ‘OK’ in the contact php file, it will return that success div without any issues. That’s the quick fix, but the problem with that is the fields div doesn’t get removed. Not that big of a deal, but sort of unprofessional, especially since the data in the input fields are still there after a successful submission.

    It seems as if the ‘OK’ echo string thats returned on success isn’t interpreted correctly by Smarty. Since it displays that echo string, I guess it takes it as a literal character. I tried taking the JS for this and putting it in an external JS file and linking to it in the header, but that didn’t change anything. Maybe I need to assign the return value as a smarty variable and then pass that to the JS somewhow. Bleh. 😛

  56. IASIIS says

    Hey Gabriel,

    Thanks for that info but I think it will take me some time to learn how to utilize JSON to reach the previously stated goal.

    On another note, I have made some cosmetic changes to the contact form on my site. One of them was adding a 110 pixel wide background image (which contains a 55pix wide a:link state and a 55pix wide a:hover state) to the button div. I would like to create a rollover version so when someone is hovering over the button div the background image position will shift left by 55 pixels which will revealing the a:hover part of the image.

    Some one from another forum suggested implementing JQuery event handlers that would be able to shift the background but, since I am a beginner I haven’t a clue how to work them in.

    One other change I made was getting rid of the text which appeared next to each text fields. Instead I placed them inside each of the text fields so when the form loads you will see “name”,”email”, “subject” appear inside their related text fields. I can not get it so that the word “message” appears inside of the message div.

    Any ideas on how to solve these two problems?

    Here is the link to my contact form page:


    P.S. I have had to translate the OK and Error messages as well as “name”,”email”,”subject” into the Polish language so it may seem a bit strange but the form layout is structurally the same as you have in the tutorial. With Firebug you can see all the code. If you don’t have Firebug then I will post the code if you need it.

    Thanks and take care,

  57. Jitendra Vyas says

    is it must to have a mail account on our own domain to use this script. can i get all mail through this form on my free gmail(not gmail apps) account

  58. RichardF says

    Hi, great script got it working no problem. Just 1 quick question: I want to use the form as a kinda reservation form so I have added a drop down list of dates for the user to select. It doesn’t have to be validated, but I would like it to show up in the email. How do I get non-validated fields to be shown on the sent email?


  59. Houssam Ballout says

    Thanks a lot for this great tutorial, I was wondering, if I can use 2 forms on the same web page?
    thanks in advance

    • GabrielGabriel says

      This topic was discussed before. In the zip archive containing the tutorial’s files you can find multiple_forms.html which has 2 forms in it. This way you will see how multiple forms can be added in the same page.

  60. says



    So everytime you press Submit, the loading message will appear.

    – In response to Gabriel’s “Adding a loading message” entry on Nov 15th, 2008.

  61. Tom says

    This form is great, and exactly what I was looking for.

    However, I just noticed, that when someone attempts to use the search form in my sidebar, instead of searching, it submits the e-mail form (which then produces error messages because the e-mail fields weren’t filled out).

    How do I keep it from conflicting with my search form submissions?

  62. says

    Hello, this for the updates all question you answer to this page..

    I just have a basic question.. I have 2 forms in one page using this script. the problem, i think when I click to submit the other one. the error msg will show on the first form I have.

    pls let me know what i need to do with this..

    Thanks and more power!

  63. says

    Hello one more thing. do you have a credit card validation and phone number function of this script? pls can i have it?? thanks a lot for the help!

  64. says

    hi pls ignore my 1st question.. I just read the comment and I will download your latest file.

    I think this is the only I need if this is possible..

    how can add a credit card and phone number validation function of this script?


  65. Brian says

    Hey Gabriel, awesome script BUT I have one problem, can you help?

    When I receive my email after entering the info, ONLY the “message” is in the body of the email and it appears in the subject line of the email…

    Is it possible for the email to have this data…

    Subject line in email inbox “A user at yoursite has sent an email”

    Body info in email:

    Name: users name
    Email: users email addy
    Subject subject user entered
    Message: message user entered

    is this possible with this script?

      • Brian says

        Hey Gabriel,

        I did what was mentioned in the previous post, but what shows in the subject line of the email is this…

        “A user at yoursite has sent an email.” BUT then it puts all of the answers in the subject line of the email too.

        Thats what I can’t figure out, I just want it to show the line I said.

        Also, I have 2 radio buttons, one is YES one is NO, can those be validated and data sent in the body of the email too?

        Also, email validation? User types it once, then has to again otherwise it gives an error?

        Sorry man, I’m not a programmer but am doing VERY well with this amazing form script, there are just a few things I can’t figure out.

        Thanks much.


  66. stuart says

    Thanks for your great bit of code.

    When I try to navigate away form the page where the form is displayed before entering any data, “This field is required” is displayed on one of the input boxes and the page remains displayed.

  67. says

    Hey Gabriel,

    Fantastic article, very insightful and well laid out. I have tried to implement this on my own website but unfortunately I never receive the email.. The form itself works perfectly, if the correct information isn’t present it doesn’t validate and if the correct information is present it hides the form and displays a success message, yet I never receive an email. I have tried the mail() function before and I know that my host supports it so I’m truly stumped on why it isn’t working. Perhaps you can find the problem?

    Best regards,

  68. says

    Hey Gabriel,

    I seemed to have solved the problem, sorry to waste your time!!

    Unfortunately I still have one other problem. With my website, I dynamically load in content using jQuery and AJAX. The only problem with this, is when I load in the content, in this case the contact form, it’s loaded after the DOM has been initialized. To fix this on other pages (let’s say where I’m using lightbox) I simply reinitialized that code but with your code I’m not sure how to accomplish this. Any chance you can help?

    Best regards,

  69. says

    My final post so as not to spam your forums :)

    I figured out how to reinitialize the form and in the process may have further advanced your script, I’ll leave that judgement upto you. I’ve condensed your code into 2 files, 1 JS and 1 PHP. The code looks like this:

    $(document).ready(function() {
    $(“form”).live(“submit”, function() { var str = $(this).serialize(); $.ajax({
    type: “POST”,
    url: “scripts/contact.php”,
    data: str,
    success: function(msg) {
    $(“#note”).ajaxComplete(function(event, request, settings){
    if(msg == ‘OK’) {
    result = ‘Your message has been submitted, thank you!';
    } else { result = msg; }

    }); return false; });


    /* Credits: Bit Repository */

    define(“WEBMASTER_EMAIL”, ‘[email protected]’);
    error_reporting (E_ALL ^ E_NOTICE);
    $post = (!empty($_POST)) ? true : false;

    if($post) {

    function ValidateEmail($email) {
    $regex = “([a-z0-9_.-]+)”. # name
    “@”. # at
    “([a-z0-9.-]+){2,255}”. # domain & possibly subdomains
    “.”. # period
    “([a-z]+){2,10}”; # domain extension
    $eregi = eregi_replace($regex, ”, $email);

    return empty($eregi) ? true : false;

    $name = stripslashes($_POST[‘name’]);
    $email = $_POST[’email’];
    $message = stripslashes(htmlspecialchars($_POST[‘message’]));

    $error = ”;

    if(!$name) { $error .= ‘Please provide a name you wish to be addressed by. ‘; }
    if(!$email) { $error .= ‘Please enter an email address. ‘; }
    if($email && !ValidateEmail($email)) { $error .= ‘Please enter a VALID email address. ‘; }
    if(!$message || strlen($message) < 10) { $error .= “Please enter a message [10 characters min.]. “; }

    if(!$error) {
    $mail = mail(WEBMASTER_EMAIL, ‘[Contact @ebarer]’, $message,
    “From: “.$name.” \r\n”
    .”Reply-To: “.$email.”\r\n”
    .”X-Mailer: PHP/” . phpversion());

    if($mail) { echo ‘OK'; }
    } else { echo ”.$error.”; }


  70. Christian says

    Hi, is it possible to clear the form fields if successful as well as display the success message?

    • says

      Hi Christian,

      There is a way to clear form fields if successful by simply doing:


      In the If statement msg == ‘OK’

      Then that should the clearing of the form values.

      Hopes this helps :)

  71. Scott says

    Hi, is there a way to consolidate the contact.html and contact.php files into one page?

    Im trying to make the form work all as one page if possible. (I’ve already put the config.php and functions.php code into contact.php)

    Great form though either way!



  72. George says

    Can anyone tell me what to do to add a checkbox that if checked to send a copy of own message to the email user enters?

    Thank you.

  73. John says

    Hello. Any clue as to why my email sends but the “Thank you” message does not? Its just showing the form.

  74. prady says


    I always get an alert saying “success” everytime i click the submit button.
    What am i doing wrong??
    Pls help

  75. prady says

    I figured that out. I didnt up the jquery-1.2.6.min.js.
    I would like the form not dissapearing.Just the message coming in and after sometime it fading away
    How can we do it?

  76. ned says


    Thanks for this useful tutorial, the only problem I am running into is validating XHTML 1.0 Transitional below is the error I get:

    document type does not allow element “div” here

    result = 'Your message has been sent. Thank you!</d

    The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements — such as a "style" element in the "body" section instead of inside "head" — or two elements that overlap (which is not allowed).

    Is there any way to get around this?

    Thanks again!

    • GabrielGabriel says

      @ned, thanks for your reply. To get around this, just put the javascript code in an external file. That validator (I think you used http://validator.w3.org/) did not strip the javascript code and detected that DIV inside the HEAD section of the page.

  77. ned says

    Thanks you for the reply, I seem to have a larger problem at the moment where I believe it is conflicting with another script I have on the same page.

    If you look here : http://www.talkpaths.com/UP/index2.html

    you see there is a rotating news section on the lower right. In this version I have not added the javascript to the document, but with all things the same, if you look here


    I have inserted the javascript and the image rotater is disabled.

    I really need both pieces of code, any advice how to make them work at the same time?

    Thanks again!

    • ned says

      actually I am having this same problem with all other js scripts I use on the same page as the form, it makes the other js functions null and void. for example, if you look here:


      there is a popout image viewer.

      That same image viewer is implemented here:

      but because I added the contact form to the side panel, the image viewer no longer woks.

      Basically I really want to use the form I made following this tutorial but if I can not get it to play well with the other js snipits, then I have to start over and find another tutorial…

      • GabrielGabriel says

        @ned, follow these steps:


        <form action="javascript:alert('success!');">

        and replace it with:

        <form id="ajax-contact-form">

        In inline.js replace $(“form”) with $(“#ajax-contact-form”) and $(“form”).serialize(); with $(this).serialize();

        I have seen that you are using MooTools. This library may be in conflict with JQuery. Consider checking the following URL: http://docs.jquery.com/Using_jQuery_with_Other_Libraries

        Another thing that I have noticed is the fact that you include 2 JQuery libraries. Why? Only one is enough.

        • ned says


          Thanks again for your time and help. The fix you suggested did not work. I am assuming it is conflicting with mootools so I will try implementing a fix from that link you sent me.

          Just to make sure you were looking at the right document:


          Am I still using two jquery libraries? If so can you tell me their names?

          • ned says


            yes I guess I do. No clue how to fix that at the moment though. Could it cause problems?

            I think I need to give up on getting your script to work with mootools as well…

            Thanks for taking the time to check that out for me, and for the contact form tutorial. I am sure I will use it on future projects, and hopefully not screw it up as bad :)

          • GabrielGabriel says

            @ned, I doubt that the usage of both libraries can be the cause of the problem. I remember I have mistakenly used 2 in the same page and the scripts were working fine. If you agree, I can fix the problems you have on the site for a small fee. You can contact me via email (the address is on the site).

          • Anthony Evovo says

            how can I validate more than 5 fields?.I only see 5 out of 8 validation fields on my form.

            Can you please tell me what I am doing wrong?

          • Gabriel C.Gabriel C. says

            The premium contact form has just 5 fields. To add more, you just need to edit the application (at least the HTML page and the PHP page that parses the data). Please contact me at support ( @ ) bitrepository ( [dot] ) com if you need further assistance.

  78. deva says

    this code is fine. can you show me,when click link ajax should be happened.can you give me some example like this

    • GabrielGabriel says

      @vjive, it can be added but not in AJAX. Many applications that you see out there are actually using IFRAMES to upload files. They just imitate the AJAX process.

      • Deyn says


        Did you find out how to upload file?

        I am trying to make it possible to have a input file in my form which is then attached to the email message using the AddEmbeddedImage function of phpmailer.class but no luck :(
        When I submit the form something goes wrong and my $_FILES[] array is empty.

        Otherwise AddEmbeddedImage function works fine when I set a path of a file on the server.

        Please let me know how to do it.


  79. Kenny says

    Does this not work in IE6. Even your demo page doesn’t work in IE6. You can’t type in the input fields. Thanks for the tut it came in very handy.

    • GabrielGabriel says

      @Kenny, I have just tested the form in IE6 (it’s not the first time) and it really works 100%. Maybe you are having problems with your IE.

  80. says

    I’m trying to re purpose this for a more advanced form. I was wondering how I could validate the name field on a function. I tried a few things with eregi_replace and I seem to be missing something.


    • GabrielGabriel says

      @bingeboy, How do you want to validate the username? Most of the accepted usernames in form fields should contain letters, numbers, periods and underscores.

  81. says

    Works perfectly , but i can’t get the correct information from ajax form. Some characters (çşüöğı) are NOT viewing fine. For example:göktürk , ÅŸendoÄŸan. How I can fix that?

  82. Paul says


    Got the form working great thanks.

    Keeps going to my spam folders though which is a shame

    A workaround for this would be to set the From: in contact.php to a designated name such as “Contact Form Submission from http://www.yourdomain.com

    But i have had no luck changing the contact.php for this, because when i do i get a syntax error on line 54.

    Any ideas??


  83. Bodhi says

    Hi! Great stuff and thanks for the hard work from all on this. I’m just wondering if anyone has had a problem with their “reply to” code in the config file? When I reply to one of the emails that I recieve using your code, it sends it to my email address as this is what is said to be done in the instructions. If I leave blank, it sends it your_domain.com…it sends it whatever I have in the config file rather than to the actual email account the message has been sent from. So, as a designer I’m unsure how to get the variable in there that is required to make this work properly. Any help much appreciated!


    • ohboy says

      You’re right, I got the same issue. There are a couple of errors in the code.

      This is how I fixed it. This is an excerpt of the contact.php file, I’ve modified the reply to passage:

      $mail = mail(WEBMASTER_EMAIL, $subject, $message,
      “From: “.$email.”\r\n”
      .”Reply-To: “.$email.”\r\n”
      .”X-Mailer: PHP/” . phpversion());

      Also, I’ve removed the reply-to stuff in the config.php

      hope it helps

  84. says


    Thanks for this script, it’s great.
    I’m reworking my site at the moment and this has been a big help.
    I ran into an issue around what happens when the user has JS disabled.
    So I started working on a solution which was to hide the form if js was disabled and display an email link.
    But I found a solution here – http://www.webmasterworld.com/javascript/3599878.htm
    Using jquery I added this code to contact.html


    fieldset {
    display: none;
    .has-js fieldset {
    display: block;
    .has-js p.use-email {
    display: none;

    Our contact form requires JS.....

    I’m not sure if this is the best way to do this, but it gets the job done.
    Hope this helps someone.


  85. says

    Hey, you did a nice work here. Hope you can understand me, my english is very bad.

    I’m trying to give a format to the mail you receive, but i’m not very sure where i can do that.

    Ok, thanks

  86. micke says

    I realy liked this form, im trying to add some more fields to it, but whit no succes. Can you pleace give me a hint.
    Here is the code im trying to work whit







    Har du något medelande till oss?

    In the contact.php i have added the new variables

    $name = stripslashes($_POST['name']);
    $email = trim($_POST['email']);
    $subject = stripslashes($_POST['subject']);
    $message = stripslashes($_POST['message']);
    $adress = stripslashes($_POST['adress']);
    $postnr = stripslashes($_POST['postnr']);
    $ort = stripslashes($_POST['ort']);

    and included them in the string

    $error = '';

    // Check name

    $error .= 'Please enter your name.';

    // Check email

    $error .= 'Please enter an e-mail address.';

    $error .= "Please enter your message. It should have at least 15 characters.";

    $error .= "Please enter your message. It should have at least 15 characters.";

    $error .= "Please enter your message. It should have at least 15 characters.";

    if($email && !ValidateEmail($email))
    $error .= 'Please enter a valid e-mail address.';

    // Check message (length)

    if(!$message || strlen($message) < 5)
    $error .= "Please enter your message. It should have at least 15 characters.";

    But its here i think the failure comes along, how do i do to get the new variables to be sendt whit the other information.

    I have tryed this but whit no success

    $mail = mail(WEBMASTER_EMAIL, $subject, $ort, $postnr, $message, $adress,
    "From: ".$email."rn"
    ."Reply-To: ".REPLY_TO."rn"
    ."X-Mailer: PHP/" . phpversion());

    echo 'OK';

    echo ''.$error.'';


    Any tips to whats wrong?

    Sorry for my bad english.

    • GabeGabe says

      The form just sends the values to the PHP file (contact.php) that processes them and sends the message using the mail() function.

      • Luke says

        It’s seams to work on my Mac development computer but on my windows web server it does nothing when the form is submitted.

  87. Sud says

  88. Warrick says

    i get the following error Deprecated: Function eregi_replace() is deprecated in php 5

    Anyone know how to fix this?

  89. Alex says

    I appreciate your effort building, posting, and replying.. but I’ve encountered an error (and errors have come up on all ajax/php scripts I’ve tried..

    whether or not I enter information in the forms and click submit, I get the following error

    ‘.$error.”; } } ?>

    just below the Contact title on the demo page.

    I had a feeling it was to do with testing locally, but I’ve uploaded the demo exactly and it still has the error.
    I’d appreciate any info that could help me out. Cheers, Alex.

    • GabeGabe says


      What you have encountered is not an error. You need to put the files in an environment where PHP is enabled. This could be your localhost or a website. You are not the first that tells me about this presumed “error”. In my post’s title and description I have clearly specify about PHP. I understand that you are a beginner that needs assistance. Also, I have reasons to believe that you encountered the same “problem” in other scripts as well (as you mentioned in your comment).


  90. jimmy says

    hi there, thanks for the nice work.
    I’m wondering, how can I add a “please wait” message or a progress bar image right after the user click the submit button?


  91. Nacho says

    Hi! Great stuff this form!
    I really need help here, i’m building a form that have multiple checkboxes and don’t find the way to process that important data. I search a lot in differents webs and i try differents methods but nothing works to me.

    I have to say also that i’m not a php, jquery or ajax expert but also i’m not a lazy person, i really search a lot but nothing works…

    So if you can help me to process the multiples checkboxes I’ll be very grateful.

    Thnks a lot ando sorry for my bad english.

  92. Steve says

    The only problem I have is that I don’t receive an email with the form data… Is there anything that I am missing in my code?

    Who can debug my code granted I post it or email it to someone??

    • Huroman says

      After 3 hrs i did it!

      In contact.php insert:

      $postspam = (!isset($_POST)) ? true : true;

      $human = stripslashes($_POST['human']);

      $error = '';

      if (!$human)
      $error .= 'SPAM.';
      echo ''.$error.'';

      // End of Anti Spam

      Hope it helps to someone!

  93. says

    I’ve used this script with excellent results in the past.

    This time I’ve tried to include it inside an “ajax content” popup based on ThickBox 3.1. (http://jquery.com/demo/thickbox/).

    The problem is that when loaded in the ajax popup the form validation doesn’t work and also, the email is not being sent.

    The “Success!” messages displays, and if I remove that event from the FORM tag, the form still doesn’t do anything.

    Any hints on how to get this going?

    For now I’ve left the form inside the html page and it works great.

    Would love to have it inside the LightBox popup.

  94. says

    It would be interesting if there is a way that on the “thank you message” to list an URL depending on which drop-down option was chosen from the form.

    Is there a way to patch feedback.js so that a specific URL appears on the “thank you message” if the OPTION “GREENWAY” has been chosen from the SELECT “solution_provider”, but a different URL appears on the “thank you message” if the OPTION “ORACLE” has been chosen?

    Would assume the change should be made inside:

    if(msg == ‘OK’) // Message Sent? Show the ‘Thank You’ message and hide the form
    result = ‘Your request has been received. Thank you!';

    Any hints?

    Thank you!

  95. patricia says

    Has anyone encountered any problems with Yahoo! Small Business hosting and this form? It works great on my GoDaddy Hosted site, but on my client’s Yahoo hosted site, it doesn’t work. Thoughts? Thanks!

  96. says

    Implemented your form. Any idea why under ie8 (only ie8) it prints an alert box that says “success”? anyway to make it work in ie8 like it does in other browsers?

    • GabrielGabriel says

      Most probably you didn’t setup the script correctly. That alert is actually the response returned in case you do not have JavaScript enabled OR you have modified the form and the JQuery code doesn’t have any effect when you press the submit button. It is just a dummy ‘action’. I will update the form tag anyway because it creates confusion. If your problem persist and you need help installing the form on your website I can help you for a small fee.

    • GabrielGabriel says

      It may be something regarding the configuration of PHP on your server. However, I have updated the script. Consider re-downloading it. If that problem persist and you need help getting rid of it, I will help you to setup the form on your website, free of charge 😉

  97. davide says

    Hi mate, nice work,

    I need your help to understand why all the email that I receive through your form are coming without Apostrophises.

    Lots users are Italian and they used to use lots Apostrophises.

    Any ideas? Does depends from the DOCTYPE?

    Please help.



    • GabrielGabriel says

      The DOCTYPE has nothing to do with it. I made some test and the apostrophes are showing fine. Keep testing! Try to test the script in other hosts too.

  98. tj says

    Just bought Premium script: I have added my email address to relevant scripts and uploaded all files to my PHP server. The form is displaying correctly and CAPTCHA image is showing, but when I type the CAPTCHA code it deosn’t validate. Nothing happens… I refresh and a new code appears and I type it but still nothing happens. The form cannot be submitted as is. I require captcha. Any idea? [PHP 5.2.0 with GD library enabled.]

    • GabeGabe says

      Please send me the URL to the contact form at support ( @ ) bitrepository { dot } com. I need to make some tests too. I am not sure how you tested it and what browser and OS you’re using. Perhaps you didn’t setup the script correctly or there is something related to your PHP configuration. We’ll fix this 😉

      • Tj says

        In case anyone else has this problem, it was a typo in the script:

        In the realtime.validator.js, on line 153, you will see $.ajax. Change it to $j.ajax.

        Thanks Gabe for spotting this.

  99. Oliur says

    Hi Gabriel,

    I was playing with your demo and when I disabled javascript in the browser the validation doesn’t work.

    I am planning to buy the premium version. Will I have php validation in place in that version?(in case the Js is disabled)

    • GabeGabe says

      The real time validation can’t work without JavaScript enabled. However, the fields are validated in PHP to prevent SPAM and the script sends the mail only if the required fields are filled correctly. I will add a feature that will gracefully degrade the application for users with JS disabled and notify you when the script will be updated 😉

  100. kikimoto says

    I loaded the form inside a facebox, it works fine with IE and Firefox, but not in Safari I keep getting a pop-up window with a “success!” displayed. when I click on submit…

    Any ideas on how to fix it?

  101. says

    Hi there! This is a really nice form, I’m interested in purchasing the premium version. I’ve tested it and it works, everything nice n neat! One small problem though:

    I need it for a Greek website. When I send a Greek message and receive it in my inbox, Thunderbird does not “realize” that this is in UTF-8, so, the message appears with “jibberish” at start. When I set the encoding afterwards, it’s readable. How can I “tell” the recipient that “hey, this is a UTF-8 message”. Can I set it somehow, and where?

    Thanks a lot, good work and looking forward to hearing from you :)


  102. seul says

    i get this error: {“sender_name”:1,”sender_email_none”:1,”sender_subject”:1,”sender_message”:1,”security_code”:1,”status”:1} what could be causing it!?

    • Gabriel C.Gabriel C. says

      This is not an error. It is the output resulted from parse.php. The form validation triggers after DOM is ready (all page elements are loaded). You probably clicked “Submit” before the page loaded completely. I will think of a solution for this too.

      • Sketch says

        i ALSO get this error: {“sender_name”:1,”sender_email_none”:1,”sender_subject”:1,”sender_message”:1,”security_code”:1,”status”:1} what could be causing it!?

        i found it needs 2 fields entered before it wont error.

  103. vaughan says

    Hi Gabe,
    Great script, just a quick note. phpmailer isnt liking PHP 5.3.

    Is giving me an error on line 470 split().
    Have tried using preg_split() but no luck.

    I think ts fine with previous versions of PHP.

    Let me know if you find a solution.


  104. Stan says

    Great script. Still trying to learn all that it does.

    Is there a way to make the confirmation email (auto_responder) not show the reply-to email address that the form is set to send to?

    like I want to set the reply-to email in the confirmation email to something like [email protected] rather than the email the form is sending the message to.

    Any thoughts? Thank you for your time.


  105. Clifford says

    Hi Thanks for the script.

    When the form is submited. I get
    Your message has been sent. Thank you!

    But when I go to my in box there’s no email address, name or subject only what’s be put into the comments box.

    Please can you advise
    Many Thanks

  106. Oli says

    Hello Gabriel-
    I love this script!!! Everything is working perfect but one thing I can’t figure out is that I do not receive the actual emails people send, while users do receive their confirmation emails without problems.

    Could you give me some assistance to where the fix for this is?

    Thanks in advance!

  107. says


    thank you so much for this script.

    I have spent countless hours trying to implement a contact form into my Drupal site as the inbuilt one was not up to scratch.

    This form works an absolute treat and does not interfere with any of the existing block styles.

    I just have to tweak the styling a little now to fit more comfortable into my page.

    Kind regards..,

    MT. ;0)

  108. says


    after installing the form yesterday and it worked perfectly for some reason today it is producing an error dialog everytime a keypress is made in the security code textbox:-

    Error occured:[object XMLHttp Request]

    I ahve not changed anything in the form from yesterday when it was working, is this an error with my server or something?



      • says


        the form is at:-


        the only thing that I have done this morning was to upload an ajax-loader.gif into the images folder as I saw there was not one there and it was being called via js.

        I can’t really see how that would cause this.

        I have got my host looking into the error to see if it could be server related but I would appreciate your point of view.



        • MadTogger says


          very strangely I have just checked the form again after my last post and it seems to be working without errors, how wierd, must have been server related, sorry for the inconvenience.

          I also see that you have sent through a test message via the form, so that worked then.



          • says

            I also get the “Error occurred: [object XMLHttp Request]” in a pop-up dialog for a period of 5-10 minute every now and then. No changes were done before, during or after. It’s pretty annoying since the pop up message goes into a loop and you can’t even close the browser. I have to go into task manager and end the process manually. I do not wish that upon any of my visitors trying to contact me :/

            Any ideas?

          • Gabriel C.Gabriel C. says

            @Adam, can you share us the URL to the Contact Form? That would be helpful to figure out what’s really the problem.

          • says

            I forgot to mention it only happens when typing out the 2nd or 3rd letter of the captcha code. It happens rarely but I had it happen to me yesterday.



            I did one minor change in the contact-script.php, and that’s move the captcha div to display next to the input-field ( I was having layout issues). But that isn’t the cause of the error since I had the it happen to me a few times beforehand.

          • Gabriel C.Gabriel C. says

            @Adam, I made several tests and I didn’t see the error. What browser are you using? When you will see this error next time, please make a screenshot and share the image with us. Upload it somewhere on your site.

          • says


            Just as I was checking to see if the image loaded onto the server, I realized something.

            I was at akrilic.com, not http://WWW.akrilic.com
            Then I remembered that on my contact page, I’m <?php including contact-script.php through my full address (including www.) , because including it on the page without the full address didn't work.

            I think I'll just copy the contents of contact-script.php into the body of my contact page (and moving the contact-app directory up a few), instead of <?php including it. It should work, I'll try it out later. Unless you know of simpler solution?

            Anyway, thank you for an awesome script!
            -NOW- i love it 😀

          • Gabriel C.Gabriel C. says

            @Adam, the security code is verified using AJAX. When you try to load data from a different host you get an error (‘Permission denied’ – when using IE – shows when click on the “Error on page” from the status bar).

            Here’s a URL address that explains you this more properly:

            >>> If the page with the XMLHttpRequest is on a http:// URI (on a webserver), it is not possible to fetch data from another domain!!! This is a security measure of Mozilla/Firefox.

          • says

            Initial Problem:
            <?php include '/contact-script.php'; ?

            Minor Solution:
            <?php include 'http://www.akrilic.com/contact-script.php'; ?
            (full URL) – the problem with this is that I would get the XmlHttp error when visiting the page without the www. prefix.

            Full solution:
            <?php include 'contact-script.php'; ?
            (without full URL and without a ‘/’ slash in front.

            Very simple, I guess I jumped the gun on that one

            Like they say: It’s always a simple directory issue.

          • Gabriel C.Gabriel C. says

            @Adam – Well, this is not a solution. That include function has nothing to do with the path that is generated in the JavaScript code. I will consider upgrading this script so it would work flawlessly with/without www extension.

  109. says


    sorry to bother you again but the error I spoke about earlier has come back again and this shows when using Google Chrome.

    I have tested the form in IE8 and where I did not get the error dialog when typing in the security box, when I hit send I received this error message on a blank webpage:-


    obviously the webpage was blank apart from this and was page:-


    I would really appreciate any pointers here, could this be a server thing or not?



  110. says


    did a little research about the [object XMLHttp Request] error and found that if I set;

    var js_realtime_validator to false in (init.js) this error does not appear when typing in the image captcha security box but the form will not send either.

    I don’t really know enough to figure out why this is happening or why setting the variable to false causes the error dialog box not to appear.

    Is there anything I can do to resolve this?



  111. Turgay says

    hello, can you please help me to add turkish language support to this beautiful script ?
    I changed it to utf-8. also tried windows-1254 charset but it didnt work.
    Messages are fine but subject names show “����” characters.

    Any help will be appreciated.

  112. says

    It would be great to prevent users from submitting the form multiple times.

    Adding something like this to line 47 (contact-script.php):
    onClick="this.disabled=true; this.value='Sending'; this.form.submit();"

    Unfortunately, with the above code, if a user gets an error from name, email, subject, etc, then they won't get a second chance since the button is disabled.

    Is there a way to activate this only after they've passed through all the checkpoints?

    • Gabriel C.Gabriel C. says

      Yes, that’s a good idea. I will consider upgrading the script, but I will not use inline JavaScript. I am trying to keep the HTML code as clean as possible. When the user clicks submit, the button is disabled and a loading spinner .GIF image can show until either the error or confirmation message appears.

  113. Jamie Hope says

    Hi there – nice script thank you. It all seems to work but when I get the message all i see in the email is the actual message and not the name or email. Any idea what may be going wrong?

  114. jan leeks says

    Thanks for the script, I am planning on using on a site in the very near future. If I wanted to add new fields to appear in the email, how would I go about that?

    I have tried and have the alert function working, but am not sure where to add the extra item for it to appear on the email.

    I assume it goes somewhere in here

    $mail = mail(WEBMASTER_EMAIL, $subject, $address,
    "From: ".$name." \r\n"
    ."Reply-To: ".$email."\r\n"
    ."X-Mailer: PHP/" . phpversion());

    my new element is called $postcode, but I am planning on adding quite a few.

    Any help would be greatly received.


  115. jeezyo says

    I purchased a theme that includes this contact form, and i am having on problem. I need for the messages that are submitted to me, to appear they are coming from my email address. It has to be this way to get through the spam filters. Is there someplace i can change it, as it currently shows the senders address?

  116. mark coley says

    I purchased the ajacx contact form script several days ago, and although the emails aer sent, i am having a problem with the capthca. Event hough i enter the correct code I keep get the message incorrect code.
    It apears that both sessions and cookies are not working as expected (ie im passing session id in url). I think that cookies/sessions are being set but cannot be read because we are not trendedgecapitals.com. Do you have a workaround for this?

  117. says

    Hi, I’m new in web designing, just trying to get your code into my website.

    I’m trying to put your code into my reservation page here http://www.kamarhotel.biz/ajax/reservation2.html but it seems something is wrong as the date is not loading but I don’t know where I did wrong. Can you advise me?

    I will put credit to you at the bottom of the page, if allowed. Appreciate if you can enlighten me :)


    • Gabriel C.Gabriel C. says


      The information that is filled on the form is sent to contact.php. However, when I access http://www.kamarhotel.biz/ajax/contact.php, I get a “Page not found” error. So consider downloading the tutorial files and get contact.php. Make sure to modified it to your needs. If you want an easier way to add/edit/remove fields you can purchase the Premium AJAX Contact Form for just $5 USD.


  118. dave says

    Clueless why your basic form is not returning form fields.

    I submit and in my email I see no name, email address, or subject, only comments.


    • Gabriel C.Gabriel C. says

      It is not clueless. You just have to edit the contact.php page and add the fields values inside the mail body message. Also, both the name and the subject are shown because they were added in the mail headers (from: [field name value], subject: [field subject value]).

  119. Dave says

    Is it possible you can you check the contact.php script below as it seem to only have only the (if) statements so I am not clear on what you mean sorry. I thought that as long as the fields were in contact.html they will return their values in my email once sent.

    I also provide a test


    Hello World

    include 'config.php';

    error_reporting (E_ALL ^ E_NOTICE);

    $post = (!empty($_POST)) ? true : false;

    include 'functions.php';

    $name = stripslashes($_POST['name']);
    $email = trim($_POST['email']);
    $subject = stripslashes($_POST['subject']);
    $message = stripslashes($_POST['message']);

    $error = '';

    // Check name

    $error .= 'Please enter your name.';

    // Check email

    $error .= ‘Please enter an e-mail address.';

    if($email && !ValidateEmail($email))
    $error .= ‘Please enter a valid e-mail address.';

    // Check message (length)

    if(!$message || strlen($message) < 5)
    $error .= "Please enter your message. It should have at least 5 characters.”;

    $mail = mail(WEBMASTER_EMAIL, $subject, $message,
    “From: “.$name.” \r\n”
    .”Reply-To: “.$email.”\r\n”
    .”X-Mailer: PHP/” . phpversion());

    echo ‘OK';

    echo ”.$error.”;



    • Gabriel C.Gabriel C. says

      In order to include the other fields inside the mail body, you have to edit the $message variable. I’ve explained this to someone some time ago. You can check the following comment reply: http://bit.ly/cybzSr

      PS: You can purchase the premium AJAX Contact Form for just $5. It has lots of feature and it’s much better than the basic version.

    • Gabriel C.Gabriel C. says

      I am glad that you managed to successfully install the premium script. Most of the complains I got are regarding the initial setup of the AJAX Contact Form. I agree, Internet Explorer has issues. However, I did make the script to work with IE too. And yes, I am a Romanian [web developer].

  120. says

    Indeed, the form works with IE, the bugs are in the integration part (in a <table> or in a <div> ),that’s where (thanks God) CSS play a major role. Thanks again.

    PS: Felicitări, continuă tot aşa !

  121. Dave P. says

    Hi Gabriel,

    I’m interested in getting a single licence, but wondered if I could upgrade to the unlimited license later if I paid the difference?

    • Gabriel C.Gabriel C. says

      Hello Dave,

      Yes, you can make the upgrade to the Unlimited License by paying the difference. Just let me know when you are planning to make the upgrade, if you will first get the Single License.


    • Gabriel C.Gabriel C. says

      Chase, this feature is not yet added. I am working on it because there were people who requested it. However, can you tell me how do you want to add the checkboxes and radios? Do you want to make them mandatory? Let me know and I will see what I can do.

      PS: You can add checkboxes and radio groups but you have to edit the core scripts and you need to be familiar with PHP and JavaScript.

    • Gabriel C.Gabriel C. says

      Chase, AR_SUBJECT is actually the Auto-Responder Subject. It has nothing to do with the subject of the mail that the admin receives.

      • Chase Peysen says

        Why won’t it display a email subject. I removed (sender_subject) , but I see on line: 119 there is a default subject.

        • Gabriel C.Gabriel C. says

          If you remove the ‘sender_subject’ field, the default subject will be used. You mentioned that you see the default subject on line 119. In which file? I’m a little confused because I do not know if you modified the script files.

          • Chase Peysen says

            I’ve modified the fields, but that’s it. The default subject isn’t showing up in our emails.

        • Gabriel C.Gabriel C. says

          I am sorry, but you must have done something wrong. Did you downloaded the latest version of the AJAX Contact Form?

          • says

            I’m trying to add event tracking for Google analytics. I want to track form onSubmit. Can you tell me best way to implement this into your script.
            Gabriel, see if you can help me.

  122. says


    Does the unlimited license explicitly allow this functionality to be resold as part of a WordPress theme (on ThemeForest in my case)?


    • Gabriel C.Gabriel C. says

      The developer license allows the user to use the script on all his personal websites. To also have the right to include the script in another commercial product (for instance on ThemeForest or CodeCanyon) you should purchase the “Extended” License. I’ve updated the post and you should see it in the drop-down.

    • Gabriel C.Gabriel C. says

      I just checked the URL and the following error came to my attention:

      Invalid address: WEBMASTER_EMAIL > You must provide at least one recipient email address.

      You are not the first one that tells me about it. This is because you haven’t setup correctly your email address in common.php. It should be something like:

      define('WEBMASTER_EMAIL', '[email protected]');

  123. Anton says

    Hi there

    Great script, however, I’ve now bought a developer script and uploaded the script and I tried it once, it kinda worked, but it kept on saying Submitting and when I changed something on the common.php file, it now does not want to submit at all, I’m working through a proxy server though which caches for some time…

    So I cant really tell if I did something right or wrong, can I submit the file to you so you can check.

    • Gabriel C.Gabriel C. says

      The reason you keep seeing “Submitting…” is due to the fact that parse.php does not only output the JSON values but also some errors that are generated in parse.php including but not limited to: not settings the right path to include the necessary files, 3rd party scripts that are used in conjunction with this script. It all comes down to integrating the script properly into the website.

      I am willing to integrate the form for you free of charge. I just need the FTP information for your website. Please contact me privately for discussing further about this.

  124. Anton says

    Thank you for the quick response. I’ve managed to figure the issue.

    It was a problem of copying the email array for a new field and I forgot to remove the ’email’ => 1

  125. Kshitij says

    I need to replicate this form for each record in a list that is being displayed on php page. Let’s say there is a list of dealers, and we need to add ability so that our website visitor can click a “send email” link, fill the form and send it.

    I am able to replicate this contact form of yours, but when i try to submit the blank form, i get js alert “Success!”. Though the first form in the list of records works. The rest show the message i mentioned above.

    Any help is appreciated.

    • Gabriel C.Gabriel C. says

      The ID of the form needs to be unique, as well as the other IDs from the page. Take a look at the multiple_forms.html file from the downloaded package. You will understand what I mean. That “Success” js alert should not be shown since we are using AJAX to submit the form. It’s just a dummy action (just to be there).

  126. JLee says

    I want to purchase the premium one. But was wondering if it also has the HTML page version. Thank you.

    • Gabriel C.Gabriel C. says

      The form is built dynamically, therefore it uses PHP to add the fields that you set them in a configuration file. However, you can copy the source from the generated form and use it in a HTML page. You also have to make sure that the fields configuration remains the same in the PHP configuration file (common.php). If you want to have a new HTML page with different fields, you need to edit common.php and run the script again. It will generate you the new HTML code to copy and paste in your HTML file. It’s quite easy.

  127. Rowan Gillson says

    Hi Gabriel.

    Just a quick question about the premium form.

    I want to confirm how this form would function if loaded into an iframe.

    If I used a jquery lightbox to display the form in a floating iframe, would the way the form adjusts it’s length vertically to display error and success messages break the iframe window height?

    I’m guessing that if I just add a height parameter to the iframe request that is static with enough padding that it should not be an issue but curious anyway to understand the implications of not setting a height.


  128. Mark says

    I don’t understand where the grey outer border for the whole form comes from. I’ve tried everything to find the CSS that adds it with no luck.

    How is that border added?


  129. CS says

    Hey. I need to add a mandatory Check Box at the end of my form. I bought the Premium version, just not seeing a way to do this. Please help!

    • Gabriel C.Gabriel C. says

      @Cary, at the moment, you can’t add the checkbox from common.php. Since you are not the first one who is asking for a way to do this, I will consider updating the script and send an update to everyone that purchased it. You need to add the checkbox manually. You can take a look how the “notify me” checkbox is added and try to add this one. If you are familiar with PHP and JavaScript, this should be easy to add. You just have to study the script. If you still can’t figure out how to do it, then let me know and I will try to send you the modified script. I am out of the country now and I do not have an internet connection available all the time. However, I will do my best to assist you. Good luck!

  130. Amit Jain says


    Bought the premium developer version.

    It worked like a charm at first.
    now i am getting this error:

    The mail cannot be sent due to an internal error. Please retry later!

    Server issues?

    • Gabriel C.Gabriel C. says

      Yes, it must be a server issue. You said it worked like a charm. Make sure you haven’t changed any server settings. Consider testing the script on other server too. Keep me updated! Good luck!

  131. Gus says

    This is a great form, just what i was looking for. i’m having trouble with the textbox though. if you type a continuous sentence, it works fine. but when i hit return in the textbox to make separate paragraphs, i get an error message that reads:

    “Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html. in D:\Hosting\2334727\html\contact.php on line 57″

    Can you help me out with this? Thanks!

    • Gabriel C.Gabriel C. says

      Have you tried other contact forms and you got the same warning? Usually, the mail() errors are from the server settings. I have never received such a complaint (either continuous sentence or sentence paragraphs) regarding the content of the message that is sent. f you can’t solve this problem on your own, can you send me the ftp details for your website to support ( a-t ) bitrepository ( . ) com? I can check if everything was installed correctly and give you an update regarding the situation.

      • Gus says

        ok, i was just doing some research, and i found an article that explains this error. I think the problem is in the message variable.

        “It looks like while Unix-based systems recognize \n character (the equivalent in PHP of LF – line feed) as a newline even when sending emails, Windows systems are stricter in comunicating using some textual Internet Protocols (such as SMTP) that mandate the line terminator to be the ASCII CR+LF (carriage return + line feed) sequence, which is abstracted in PHP to \r\n character sequence.”

        Can you help me incorporate this into your form?

  132. ARSHI says

    I am currently working with a slideshow using jquery-1.4.min.js…………
    while working with the contact php jquery
    jquery-1.2.6.min.js it messes up the slidehow I cant seem to make them both work together….

    can u help?

    • Gabriel C.Gabriel C. says

      Can you share us the URL to the page when you’re having this problem? I would like to inspect it. I am sorry for this inconvenience.

      • ARSHI says

        I just realized after playing it with couple of times this form is just not compatible with jquery-1.4.2. Do you know how to fix this?? Or it is not made for new version for of JQUERY?

  133. Hadi Akmal says


    I use jquery latest version jquery-1.4.2 and everytime I click Submit button the javascript popup “Success” will come out. I change back to jquery-1.2.6 and the popup is gone.

    What happen I thought jquery-1.4.2 is compatible with existing version?


    • Gabriel C.Gabriel C. says

      You’re probably using an application that is in conflict with either the contact script or it is not compatible with jquery-1.4.2. Can you share us the URL to the page where you noticed this bug?

      • Hadi Akmal says

        My apology. I have test this script this weekend with jquery-1.4.2.min.js and it’s works nicely.

        not sure what happen though.

        Thank you :)

  134. Cwhite says

    I have the premium version and I love it. The only caveat though is that the subject is always pulling in the subject field. The documentation shows where to change the value to ‘true’ for a custom subject field. BUT, I don’t know where to define that custom subject field.

    Please advise. If the documentation has been updated, please let me know. I purchased the premium version about a month and a half ago.

  135. Amy Kim says


    I have purchased your premium version. I uploaded your form and got error messages. I haven’t changed anything except entering the webmaster email in common.php.

    Here is one error message that I got.
    include_once(../../../ajax-contact-form-premium-script-developer-license/vertical-labels-layout/contact-app/libraries/php.mailer/class.phpmailer.php5.php) [function.include-once]: failed to open stream: No such file or directory in /data/19/1/7/9/1985824/user/2170139/htdocs/testing2/ajax-contact-form/vertical-labels-layout/contact-app/parse2.php on line 16

    I followed your instruction and didn’t find any information on how to correct this.

    BTW, some of your instruction (help/index.html) do not match with your code.

    For example, there is no such stylesheet.css. Just minor issue.

    Anyway, thanks a lot for a great form and help in advance.

    • Amy Kim says

      I was able to configure the above errors.
      I have another question.

      How can I add checkboxes and radio groups into $formFields?

  136. says

    I keep getting this error when I test my submit button:

    Warning: mail() [function.mail]: SMTP server response: 504 5.5.2 : Helo command rejected: need fully-qualified hostname in C:\sites\single16\oldieolga\webroot\medellin\contact.php on line 56

    Line 56 is:
    $mail = mail(WEBMASTER_EMAIL, $subject, $message,
    “From: “.$name.” rn”
    .”Reply-To: “.$email.”rn”
    .”X-Mailer: PHP/” . phpversion());

    Not sure what the problem is??

  137. Anks says

    I wanted to know how to make this into SMTP method, cuz my server filters a lot of mails coming through phpmail!

    • Gabriel C.Gabriel C. says

      In a couple of days, I will release the new version of the script that will have the feature “Send Mail through SMTP”.

  138. IanA says


    I’ve download the premium version, which I’ve installed on my test site and all is working well.

    The only problem I’ve got is that email notfications are sent twice to my webmaster address and also to the person who has completed the form.

    Does anyone have any thoughts why this might be happening? (and no… I’m not pressing submit twice!! 😉 )

    Many thanks

    • Gabriel C.Gabriel C. says

      @Iana, thanks for telling me about this. The script is made to send the mail only once, so I am surprised that you get the mails twice. Have you tried other scripts on your server that send mails? Perhaps it’s due to the server’s settings. What’s the URL to your form? I’d like to test it.

      • IanA says

        Hi Gabriel,

        I’ve just sent you a mail with additional details to support [ – @ -) bitrepository ( :dot: ] com

        I hope they help!!

  139. Steven says

    Hi Gabriel,
    Have you figured out yet how to add checkboxes and radiobuttons? It would be a great addition to your form. It would even make your form perfect :)

    • Gabriel C.Gabriel C. says

      @Steven, I am working on it. You can manually add checkboxes at this time. I know this is an inconvenience for you. I will try to release the new version of the script as soon as possible since you are not the first that asks me for this feature. The new AJAX Contact Form Script will also have the option of sending mail(s) with attachment(s).

  140. Chris says


    I would like to buy the Premium licence for this contact form, but it is important for me to know – is it possible to add custom checkboxes and dropdowns?

    Thank you,

    • Gabriel C.Gabriel C. says

      @Chris, the addition of checkboxes is not possible yet. I am working on it and it will be possible when I will release the new version of the script. The only way to add checkboxes now is manually.

  141. togc says


    I am using this function for long time. I like it very much and it works wel. The problem is that from time to time I am getting support requests from my users who can’t submit forms with this function. They say that nothing happends when they click submit button.
    I have 3 support requests from people who use Mini Opera browser and 1 support request from user who uses Internet Explorer (scripts are not disabled in their browsers).

    Any ideas?

  142. John says

    I dont understand why I cant get this to work. I made copys of all the files in dreamweaver and uploaded it to my server
    (should they be in a specific folder?,some file edited in a certain way)

    config.php(added my email)

    I get to the ‘message sent’ dialogue after hitting send. But the email never transmits to my email??
    Any feed back would be helpful. Would like to purchase the $5 upgrade but want to make sure I can make it work. Any feedback would be helpful.

    • Gabriel C.Gabriel C. says

      @John, I’m really surprised that it shows “message sent” but you just don’t get the mail. Perhaps the mail arrived into SPAM folder. The mail() function returns true if the mail was accepted for delivery so it should have been sent if you’ve seen the successful confirmation message. Where do you have your e-mail hosted? Can you test using another e-mail address?

  143. says

    Hi Gabriel I like the form, and I know how to add form field to contact.html, however I am not so clear where to add the parse info in contact.php.

    Is it:

    52.$mail = mail(WEBMASTER_EMAIL, $subject, $message,
    53. “From: “.$name.” rn”
    54. .”Reply-To: “.$email.”rn”
    55. .”X-Mailer: PHP/” . phpversion());

    • Gabriel C.Gabriel C. says

      I am not sure what you want to do. Just leave parse.php as it is. You can include the form in a HTML file. However, it will not work if the user has JavaScript disabled. If you want the form to degrade gracefully when the JS is disabled consider including it in a PHP file. Of course, you can use SEO Friendly URLs if you want (e.g. contact-us.html instead of contact-us.php).

  144. Henri says

    Hi, I’m having trouble with the script. When I click Send button it pops up an message window saying “success!” although there’s no data inserted to the fields. Also with correct data it shows the message and doesn’t send an email.

    • Gabriel C.Gabriel C. says

      @Henri, this happens if you download the form and access it directly (by actually double clicking on the contact.html file after you unzip the script package) without uploading it to the (shared/dedicated) server (which should support PHP).

  145. Jan says

    Hello Gabriel,

    I’m thinking of buying an extended license, but I’d like to know if there will be an option to use SMTP instead of the mail function in the new version?

    • Gabriel C.Gabriel C. says

      @Jan, I am almost done finishing the new version of the AJAX Contact Form that has support for adding checkboxes and radio buttons and also offers the possibility of sending SMTP mail. I’ll let you know when the new script will be ready for download.

  146. Mike says

    When I submit the form I just get “OK” above the first name input. Upon changing line 27 from:

    if(msg == ‘OK’) // Message Sent? Show the ‘Thank You’ message and hide the form


    if(msg = ‘OK’) // Message Sent? Show the ‘Thank You’ message and hide the form

    everything works but there is no validation (obviously). I went into contact.php and edited line 63 to mirror the error message div. I was able to get it to come up as it should with “1” in place of the success message. On second thought, the hide function did not work. I’m not sure how to get the notification_ok message to work…

    It DID work before, but I must have downloaded a newer version of the script?

    any help is appreciated

    • Gabriel C.Gabriel C. says

      @Mike, I suggest you re-download the script and check the differences between the original version and the one modified by you to see what’s wrong. Also, can you share the URL to the form here? I’d like to take a look at it, to see why you’re having these problems.

    • says

      I am having the same problem on the submit as you – it shows OK above the form after success. If I change it to ‘OK’, it hides fields and shows notification_ok. how was this resolved for you? Thanks!

  147. George says

    First off I’m a novice at this…..

    I’m using a program called shutterbug to install the premium contact form.

    it is not an html editor. It is designed to drag and drop html which is then linked to a web page manually.

    I need to know which folders .. files to drag into Shutterbug … Is there a main file that will start the script?

    Sorry for not knowing my html… maybe this is just way over my head.. Thanks

    • Gabriel C.Gabriel C. says

      Ola Felipe :)! Please try to write me in English from now on. Are you talking about the basic or the premium script? For the basic one you just need to check the previous comments on the first page in this post. As for the premium one you can check the documentation. It contains a section that explains you how to add/edit/remove fields.

  148. Jeanne says

    I previously purchased your contact form in the summer 2010. I am having a problem with the verified checkmark being missing when the captcha is correct and can’t figure out how to fix it.

    Upon coming here to see if I could find the answer for a fix I noticed that the form on your site is now different.

    How much does the form you are now showing for sale differ from the one I already purchased? And do I need to update mine to the newest? Are updates free or discounted?

    • Gabriel C.Gabriel C. says

      Can you share me the URL to the form? I’d like to see if you installed everything correctly.

      The form that is on the site is not yet different. The new version of the script will be released in a couple of days. I have to finish writing the documentation for it. This update is free.

    • Gabriel C.Gabriel C. says

      I see that it does work fine now. You should not get any alert message if you have JavaScript enabled. However, consider doing some CSS customization too 😉

  149. Kiddi Geir says

    Hello people,

    How can I send to multiple emails in the line:
    define(“WEBMASTER_EMAIL”, ‘[email protected]’);

    Can I add comma or ” ” or ‘[email protected]’ to send to more than one email?

    For example: define(“WEBMASTER_EMAIL”, ‘[email protected], email2, email3′);

  150. Albatros says


    I am interested in your contact form. Within this plugin, is there a way to make multiple forms easily? I am shopping around and not many seem to have an easy way to have more than one form run off the same file system.

    • Gabriel C.Gabriel C. says

      At the moment, only one form per page can be added. You should have some knowledge of PHP and JavaScript to add more forms in the same page. If there is demand, I can work on such a feature and update the current script. Or, if you are willing to purchase the current “AJAX Contact Form”, I can help you to setup multiple forms per page, in exchange of a fee.

  151. tomC says

    Hi, i recently purchased the premium developer version after testing the free version.

    all seems to work except on certain machines, in Chrome7 the security code will not work i have tried many times or get this to work. ui have used one of the examples and just changed the email in the common.php file and this still happens. here’s a link to a screenshot of it failing in chrome. i have also had a similar issue in FF 3.6.12 where the form fails to submit when the button is pressed, any help would be greatly appreciated. link to test form thanks

    • Gabriel C.Gabriel C. says

      I’ve just tested the script in Chrome 7.0.5 and it works flawlessly. Consider testing my demo page using the following URL (it’s without frames): http://bit.ly/fRUQSG

      PS: I’ve recently noticed that the AJAX Captcha is not working properly in Safari if the contact form is inside an <iframe>. Consider making some tests on the form from the above URL and let me know how it works for you. Also, do not forget to use the refresh feature to generate a new verification code.

      • tomC says

        hi, the script wasn’t in an iframe and i tried the refresh feature many times. However I was testing whilst at work(not a web firm unfortunately) and I noticed that when inspecting element, that each page had a bit of js added to the start of it by the network (called bluecoat I believe, it’s some kind of pop-up blocker from what i can see) could this be what’s affecting it? could you imagine any way around this? it seemed to work fine in IE6/7/8 and ff though. Many thanks for the quick reply.

  152. pixi says

    We bought an extended licence for AJAX Contact Form and we use it in some of our templates in themeforest. Few of our customers are having issues with the form. Some of them say the form gets stuck on “Submitting”. Some of them receive “The mail cannot be sent due to an internal error. Please retry later!” error. We think it is related to the SMTP authentication or some other settings regarding php, right? Do you have any idea about how we can solve these issues? How can we guide our clients? The form works fine with all of our templates on various hostings that we own. But 15% of our clients are having issues. We usually ask them to contact their hosting providers because we don’t have much knowledge on php and smtp authentication etc. But once we started to receive more and more complaints we thought we should ask you. We would appreciate if you could help us.

    Lastly, does the extended version have any updates?

    • Gabriel C.Gabriel C. says

      1) The output returned by parse.php is in JSON format. If more data is shown then the “Submitting…” bug appears. This is due to the fact that the format returned is not JSON anymore. In the new version of the AJAX Contact Form, I have added a debug tool that can be activated in order to see the response from parse.php. In most cases (I believe in all), parse.php generates a PHP error. This is usually a problem from the server settings (a missing PHP function, a very old PHP version) OR from the wrong setup of the ACF script. So, parse.php shows the JSON response + the generated error. That’s why it gets stuck on “Submitting…”.

      In the JavaScript file that handles the validation (either init.php or acf.init.php – depends on the script version) there is a line success: function(response) { (in the first AJAX call). After it, you can add the code alert(response);. This will show the response from parse.php and this way the customers can see what’s wrong on that side.

      2) “The mail cannot be sent due to an internal error. Please retry later!” – this is the most common error and is definitely due to the fact that the server is not configured properly to send mail. I hear this all the time (and I will hear again from now on) from around 10% of my customers. I give them the same answer: If the script is tested in localhost (and not on a live server with PHP mail() function enabled) it’s very likely the customers will see this error. They have to test if mail() works before using this script (it should work on any decent hosting environment).
      My advice would be to update the template with the new AJAX Contact Form script, test it, including debugging etc. etc. then mail the customers to re-download it (hopefully they didn’t make many changes to the template). I have to point out that the new script can be configured to send mail via SMTP method too (not only the basic mail() function).

      Let me know if you need further assistance!

      PS: Do you have the latest version of the script? You can use the same link you got to download it. If it has expired, let me know and I’ll send you a new one!

    • tomC says

      sorry stupid qustion, i had made a mistake in the css. one final question is how do i make the captcha background transparent. i found the related var in the class.captcha.php file and i have fiddled with the common.php but cant seem to get it to betransparant as i want to apply a background image to the containing div.
      many thanks

      • Gabriel C.Gabriel C. says

        To set the CAPTCHA background trasparent you should edit captcha.php (from the directory contact-app) and after:

        $captcha = new Captcha();


        $captcha->transparent_bg = true;

        This will make the background 100% transparent!

        PS: To change/remove the border consider editing #acf_captcha from stylesheet.css.

  153. Steve C says

    Can your contact form do simple math so it could be used as a simple order form? Such as: “quantity” x “price” + “sales tax” + “shipping”

      • ChrisL says

        I am surprised that this functionality has to be added – your features list suggests it can be used as an order form:
        * Contact/Feedback Form
        * Support Form
        * Customer Survey Form
        * Online Product Order Form
        * Event Registration Form

        * Employment Form
        * Make a Room Reservation Online Form
        * Send Testimonial Form
        * Subscribe to Newsletter Form
        * Gift Order Form

        • Gabriel C.Gabriel C. says

          Chris, I hope you are talking about the AJAX Form Builder, not the basic AJAX Contact Form. My feature list suggests indeed that it can be used as an order form. The list contains examples of forms that can be generated through the script. Some of the people who purchased it, already customized their forms (you can see the screenshots). It’s really easy to make an order form: you just have to edit one file, write the fields you want to have in the form (either text, textarea, checkboxes or radios) and the script will take care of everything (validation, send all the data to webmaster’s email address). Just let me know if you need more clarifications 😉

          PS: Here’s a customized order form in action: http://muranolampadari.com/preventivi.php

  154. Justin says

    HI there. I am getting a depreciated message on the functions.php page. Seems eregi_replace() is no longer valid in PHP 5.3

    Error Message is:
    Function eregi_replace() is deprecated in functions.php on line 22

    Do you know a fix for this? I’m trying to figure it out but am a PHP novice. Thanks. And thanks for making the form available!

    • Gabriel C.Gabriel C. says

      You must have got an old code where I used eregi_replace().

      In the new version of the script I am using another function: preg_replace() 😉

      • Justin says

        Awesome. I’ll get the latest version. Many thanks. And many thanks again for such a great script. It has been hugely helpful.

    • Gabriel C.Gabriel C. says

      I’d like to see the form live so I can check if everything was installed correctly. Perhaps, you have some JavaScript errors. You can check that in Firefox using Tools > Error Console > Errors. If possible, I’d like you to share us the URL to the form.

  155. tomC says

    Hi Gabriel. I purhcased the developer version of this script and managed to get it working perfectly on my test server HERE but having moved it over to the clients server HERE i seem to be getting javascript parse errors. i phoned the host (1&1) who told me the code was the issue. however i believe its something to do with their AJAX setup. i would be grateful if you could have a look at this for me. this is the error google chrome gives me

    acf.init.php:1 Uncaught SyntaxError: Unexpected token <

    and also a warning:

    acf.init.php:-1 Resource interpreted as script but transferred with MIME type text/html.

    • Gabriel C.Gabriel C. says

      Just checked the script from the clients server:

      I get the following error:

      Error: missing ; before statement
      Source File: http://www.brentwoodhairdresser.co.uk/contact-app/js/acf.init.php
      Line: 2, Column: 3
      Source Code:
      <b>Parse error</b>: syntax error, unexpected T_CLASS, expecting ',' or ';' in <b>..../contact-app/libraries/javascript.packer/class.JavaScriptPacker.php4.php</b> on line <b>69</b><br />

      Are you sure you haven’t changed anything in class.JavaScriptPacker.php4.php?

      Note: It looks like the host is using PHP4. Consider contacting them to upgrade to PHP5.

  156. Oli says

    Hey Gabriel,

    I’ve setup this script and it works perfectly but i’m trying (and failing) to make a little change. Could you help me out?

    At the moment when the form is submitted it hides the form and gives a thank you message. I’m trying to make it so that the form doesn’t hide, but instead disables the submit button and offers a reset button to clear the form. I found an example here: http://www.the-art-of-web.com/javascript/doublesubmit/ (see example 2. More User-Friendly)

    If that’s not possible, could you show me a way of adding a “new message” button under the “thank you” message which un-hides the form and resets it?

    That would seriously help me out right now!

    A good will gesture?


    • Gabriel C.Gabriel C. says

      In common.php, you have the following options:

      $acf_conf['hide_form_after_submit'] = false;
      $acf_conf['clear_fields_after_success_submit'] = true;

      If the first one if set to ‘true’ and the second to ‘false’ you should get the desired result. Do you have the latest version of the script? If you are using the old one you can find the constants that are defined (they have the same name as these variables: array keys).

  157. Oli says

    Hi Gabriel,

    I’m using the free version of your script which doesn’t seem to come with a common.php file. I can’t find any reference to $acf_conf or clear_fields.

    Could you please please show me how to add this option to the free version?

    • Gabriel C.Gabriel C. says

      In contact.html, find the line:


      Replace it with:


      This way, the form will not be hidden after successful submit and the fields will be cleared 😉

  158. Aldo says

    Hi! This is a great contact form! I have a question: I am Spanish and we use accents and the “Ñ” letter. How can it works with the accents? Does it support utf-8? Anybody can help me? Thank you!

  159. James says

    Hi all

    am using the basic version of the contact form and I (think) I’ve followed everything from this tutorial. All working but when I submit my form it says message has been sent but I don’t receive an email. Any ideas why this is?

    + beening a newbie to all this the only thing I dont get is this section:

    am I supposed to change the “WEBMASTER_EMAIL”? If so what to?

    Thanks in advanced :)

    • Gabriel C.Gabriel C. says

      First of all, make sure you test the script on a real server (not localhost). You should put your real e-mail address in config.php:

      define("WEBMASTER_EMAIL", 'your_email@domain');

      Just replace your_email@domain with your real e-mail address and it should work without any problems. Any decent hosting should have these days the mail() function enabled.

      • James says

        Yeah it is live on my server and I have changed ‘your_email@domain’ to a vaild email address but still nothing.

        Just don’t make no sense

    • James says

      Hi JP

      Yeah I finally got mine working, I was using a hotmail account email like e.g. james [ at ] hotmail [ . ] co [ . ] uk and that doesn’t work.

      I used the email from the domain name that I brought in the end and that worked perfect. e.g. info [ at ] webdesigner [ . ] co [ . ] uk.

      Hope this helps!

      • JP says

        Hi James

        Thanks for the help. I tested other email clients and they also worked.

        Any reason why this happens with hotmail?

  160. says

    Hi, this is my first time I’m trying to create a form that works as opposed to just aesthetics. :)

    I’m trying to get two jQuery scripts to work on one page.One the form, and the other is an accordion menu. After adding the form both cease working.

    I’ve done all above and there doesn’t seem to be any syntax errors but I can’t get it working?

    Please help me!

  161. ES says

    quick question, I know its 2011 and this post is old, but I have utilized this on my site. I’ve used the following fields:

    the message field appears in the subject line of the email instead of the message

    the phone, field does not get posted in the mail message. Any idea of how to get this to work.

  162. Vladimir says


    I bought the developers license from you, thank you, everything works well. Right now I am currently creating a form using the right horizontal layout, and I would like to incorporate the DatePicker function, how would I do this? So far, in the directory “Right Horizontal Label” I have added an image of a calendar and I added a folder UI with all the included files, but I was not successful. Please help me as soon as possible.

    Thank you,

    • Gabriel C.Gabriel C. says

      Hello Vladimir,

      In the “in-field-labels-layout-dp” folder look for ‘contact-app/js/acf.init.php’ file. Open it and copy the all the var dates = ..... code before the code:

      // Show the 'Refresh' Icon: This will work if JavaScript is enabled!
      <?php echo $acf_jquery_prefix; ?>('#acf_captcha_refresh').show();
      acf.init.php from “Right Horizontal Label”.

      In common.php, you must specify “datepicker” as the class for the field where you need to activate the datepicker (see ‘check_in_date’ from common.php, in ‘in-field-labels-layout-dp’).

      Consider removing the line:
      <?php echo $acf_jquery_prefix; ?>(this).parent('div').children('label').css({opacity:0, display:'none'}); It’s for the “in-fields” layout. I am sorry for this inconveniece. Hopefully you will manage to make it work! If not, you can give me ftp access to your site (via email) and I will make the changes you need.

  163. John says

    Hi everybody! I’m testing the Free Version and I’ve a problem with special characters: Does it support utf-8? How can I set up it? Anybody can help me? Thank you very much!

  164. Vladimir says

    Hi Gabriel,

    Thank you very much for answering my question, it works well. However, when I fixed the first issue, another one occured. Now, after putting in the verification code it checks it but does not show that it was successfully verified. The field completely disappears. What should I do?


  165. Vladimir says

    Nevermind, I fixed the problem, I took a part of the code from left-right-justified-horizontal-labels-layout from file acf.init.php starting from line “Security code” and ending in “/ Necessary if the form was reseted” and replaced the same part in the working file.

    Thank you.

  166. Rhodrey says

    Hi Gabriel,
    Nice tut. I managed to successfully implement this on a client website. I have an issue however. Using the localhost, the script worked perfect. Placing it on the web server is fine up to a point. The email is sent, but the fields are not hidden and the thank you message displayed. You can take a look at http://www.mpevaluation.net23.net/contact.html

    • Gabriel C.Gabriel C. says

      It looks like you’re using a free hosting service. Am I right? The output from contact.php is indeed ‘OK’ but due to your hosting account some statistics code is added automatically into any opened page OR you have added that code yourself into contact.php.

      The code is:
      <!-- www . 000webhost . com Analytics Code -->

      <noscript>&lt;a href="http://www.hosting24.com/"&gt;&lt;img src="http://analytics.hosting24.com/count.php" alt="web hosting" /&gt;&lt;/a&gt;</noscript>
      <!-- End Of Analytics Code -->

      • Rhodrey says

        You are indeed correct. I am using a free hosting service for testing purposes. Is that the reason why it fails to work as expected?

        • Gabriel C.Gabriel C. says

          Yes, that’s the reason. Do you have any paid hosting account where you can make tests? You could try Hostgator or Godaddy for a couple of bucks/month. They are quite cheap, indeed.

          • Rhodrey says

            You’re a genius! I disabled the analytics code and the script worked perfectly. Thanks a whole lot.

  167. Nikolas says

    Hi, great form, especially Premium.

    But I’ve got one question. I sent test message for my mail and got the next text:

    [chars here] just sent you a message through the contact form:

    E-Mail: email
    IP: [ip here]

    Your Name: [chars here]
    Your E-Mail: email
    Your Subject: Technical Question
    Your Message: [chars here]

    So the problem is next. Russian letters came as [chars here].
    Can I fix it and how?
    Thank you.)

    • Gabriel C.Gabriel C. says

      In common.php, find the line $acf_conf['mail_charset'] = 'iso-8859-2'; and replace iso-8859-2 with utf-8. Let me know how it works for you. It usually does for most of the people that want special characters in their mail message.

      PS: Your mail was initially marked as SPAM (perhaps due to the fact that you mentioned ‘xxx’ multiple times in the comment).

      • nikolas says

        Thank you.)
        This helps, but partially.
        The same problem stay with verification fields (‘errors’ – acf_form_fields) and acf_form_notifications ( ‘security_code_e’, ‘security_code_i_e’, ‘correct_errors_e’ and so on) Норе for your help.)

          • nikolas says

            Of course I set the right charset in the HTML page too.)
            In fact the problem only with jquery validation (when js disabled everything is ok.) I think that somewhere in json2 i just need change:
            “regex”:”/^[a-zA-Z\ \’]+$/”,
            “regex”:”/^[a-zA-Zа-яА-Я’ ]+$/”,
            or something like this.
            But I can’t do it by myself, json2 minified.)

        • Gabriel C.Gabriel C. says

          If the previous code won’t solve your problem, consider making the following change too:

          ADD header("Content-type: text/html; charset=utf-8"); in parse.php too (before any other line of code)

    • Gabriel C.Gabriel C. says

      Do you want to have half of the fields in the left side and the other half in the right side? In this case you need to edit contact-script.php and add CSS Floats: left & right. Are you familiar with HTML and CSS? Can you handle it? While looping through the form fields you need to stop at a specific field, close the first div (floating to left) then start the second div (floating to right). Make sure you use a final DIV with the style “clear:both;” 😉 I hope I was clear enough 😀

      • Dan says

        Hi Gabriel, Yeh thats exactly what I want to do. Im ok on css and html but the php not so much :-( At the moment I cant close a div at a specific point and then start another.

  168. Rafael says

    This is great, works good for me. Just one question though. Is there any way not to hide the form when the message was successfully sent?

  169. ChrisL says

    working on getting the premium script form set up as an order form – problem i have at the moment is 2 copies of the messages are sent – i.e. 2 to person filling in form and 2 to me.
    Any suggestions where I should look to correct this?

    • Gabriel C.Gabriel C. says

      Have you managed to setup the Order Form without any problems? It’s interesting that about 5% of my customers are having this issue: getting 2 emails instead of one. At this percent, it’s very likely that they are having a problem with their hosting or they have changed the script in such a way that it sends the message twice. I remember I had this problem when I used the ajaxComplete(callback) Method but I removed it and the number of complaints dropped dramatically. Have you tested the same form (as you changed it) on another web hosting? Does it act the same? I am not sure why it submits the form twice. I never had this problem on my end. I am thinking of implementing some protection that only allows the form to be submitted once.

      • ChrisL says

        Hi G Thx for the reply. Yes no problems setting up, added many fields and extra selects and check/radios all working well – tested after each mod but each time it sends 2 messages . I have noticed that it is not sending the content of the form to the person completing it, even though the setting is to do so.

        • ChrisL says

          made some edits and am trying to get 2 fields to be parsed in parse.php but get errors:
          $acf_mail->FromName = $contact_firstname $contact_lastname; have tried () around variables with a comma between but still get errors. Any suggestions?

          • Gabriel C.Gabriel C. says

            You should have a bit of PHP knowledge before editing parse.php. For instance you didn’t add the . for concatenation. Here’s how it should be:
            $acf_mail->FromName = $contact_firstname.' '.$contact_lastname;

            I assume that you already used the ‘contact_firstname’ and ‘contact_lastname’ keys in $acf_form_fields.

          • ChrisL says

            any ideas please – tried several with no success.
            Have a nearly finished example here
            Would prefer the T & C in a popup but so far not getting that to work.

          • Gabriel C.Gabriel C. says

            Consider setting the margin for #acf_fields div.wrap label.in_field to 8px 5px 5px 6px! It’s better for aesthetics. Regarding the “Terms and Conditions”, you can google for “javascript new window” or load the contents inside a modal box. The latter is a more fancy approach. Checkout Fancybox.net (click “Inline – modal window”) to see how it works 😉

            PS: The form looks nice, really! I am glad that web forms like this one can be created with my AJAX Form Builder tool!

          • ChrisL says

            “duh” :)
            Was looking at the line below for addreply to and thinking that format would work!

  170. Chin says

    Hi ! I tested the premium version and have two concerns. I want to send you screenshot to explain my concern. I can’t attach file here. Where can I send it?

    My two concerns are:
    1. The error message that appears on top “Fix the error, resubmit the form” is not appropriate.. This error message should appear only OnSubmit. User has not even tried to submit the form yet, so that error message makes no sense.Let user “submit” and then show that error message.

    Inline validation errors (fix email address, message should be more than 15 chars) are fine. They should appear as user types.

    2. When the top error message appears (“fix and resubmit”), the form actually moves. Is it possible to have the form NOT move. Maybe you can leave some space on top so error messages can appear without moving the form position. Or maybe error messages can appear above submit button or on the side of submit button.


    • Gabriel C.Gabriel C. says

      Chin, send me the screenshots to my e-mail address that can be found on the bottom of this page.

      1. That is the purpose of the real-time validation. If the user makes a mistake while filling the form, then it will see a message like “Fix the bottom errors”. This message is automatically removed once all the errors are gone. I never had any complaints regarding this functionality so far. I hope I was clear enough. Do you have any suggestions? I’d love to hear them.

      2. The form is designed that way: to move once errors show up. There are many forms out there that have the same behavior. However, your point is taken into consideration and I will think of implementing a new layout of the form that will show errors next to the fields and also the top errors without actually moving the form at all. I’ve worked hard on developing this script but I admit that it has its limitations. Taking into account that I offer a lifetime license for this AJAX Form Builder, I believe that the price is a lot cheaper (starting at 9 euros) than the ones that are charged monthly (such as $29/month) by other Online Form Builders (that don’t even offer AJAXified forms).

      PS: I am currently working on a new version of premium AJAX (Contact) Form. Some of the new features are: Load form inside Lightbox, Slider AJAX Form and Multiple AJAX Forms per page.

      • Chin says

        Hi Gabriel:
        So, your email is support…? I thought you’d have an email like Gabriel@..

        Anyway, I have uploaded screenshot here:

        Basically, I agree with the error.
        I think the top error message should appear after user clicks on “submit” button.

        The error message should appear. That’s no problem. But only after I click on submit.

        Red colored error messages appear when I type. And that’s fine. That error should appear when I go to a field and do something incorrect. That’s fine.

        You’ve two errors:
        1. field level errors — and they are fine
        2. form level errors — they should appear after I click submit.

        This is just a suggestion. I hope you don’t mind.

        See screenshot.

        • Chin says

          By the way, I am purchasing this script. I hope you can help with removing “form level error message” until I press submit.

          Field level error messages are OK as I type.

    • Gabriel C.Gabriel C. says

      This is indeed weird. I can access it without any problems. Can you tell me what browser are you using and how did you actually tried to access the live demo site? (e.g. through a link, directly by typing the URL address.). If you can make a screenshot while you are trying to access it, what would be better! You can use a service like http://www.techsmith.com/jing/ for this.

  171. Chin says


    1. Is it possible to add file-attachment field to the form?

    2. Is it possible to disable form-level error messages untill “send message” (submit) button is pressed? Field-level validation is done in real-time, and that’s perfect.

    I am trying to integrate it but not sure how to do above things.


    • Gabriel C.Gabriel C. says

      1. The form doesn’t support this feature yet. However, I am currently working on a new version of the AJAX Form Builder that will have this feature. You will get the updated version once it’s done. If you do not have patience until then, you can add file attachment using the phpMailer class (just google for its documentation and you will see how attachments can be added).

      2. Yes, it is possible. You only need to use the afb_check_status() function when the submit button is pressed. At the moment, the afb_check_status() function is triggered each time a field is completed in real-time. Are you familiar with jQuery (JavaScript)? Do you think you can do that?

      Do not hesitate to contact me if you have further questions 😉

        • Gabriel C.Gabriel C. says

          Sure Marnix, I will let you know via email when the new version will be released. It will be more expensive but since you are a customer, you can just pay for the upgrade which will be a couple of bucks (the difference between the price you paid and the price of the the new script).

          • says


            I’m also needing the file upload feature but am using Lasso instead of PHP. Do you know approximately when/if that feature will be added? Do you think there will be anything hindering it working with non-PHP middleware?


          • Gabriel C.Gabriel C. says

            I believe you are talking about the Lasso CRM (that’s at least what I’ve found via Google). If your server supports PHP, then you should be able to use the script. I’ve just finished work at the “File Attachment” feature in case you are interested. There’s no way I can make the script work on a non-PHP server. You can put the script on a server that supports PHP and then use an IFRAME to load the data from that server from one that doesn’t support PHP.

  172. maya says

    this does not work at all for me, email does not get sent, error doesn’t print.. nothing prints from the back-end after I submit.. do you provide a zipped-up package w/all files to download for this example?

    thank you..

    • Gabriel C.Gabriel C. says

      Of course, the download link can be found inside the post. It’s quite visible if you are talking about the Basic AJAX Contact Form.

  173. keal says

    We have an older version of the script from August 2010 and were looking to add checkboxes and radio buttons to the form, do we need to buy a new license to download the new version of the script?

  174. says

    Hi. I’m currently using the free version and i have one question. How can i change the “Please enter your name.” with cyrillic letters because my default language on the site is not english?
    I tryed to change it in Feedback.php but it still shows the same “Please enter your name.”, nothing changes.

    • Gabriel C.Gabriel C. says

      You need to change it in contact.php too. For future scripts, the best way to found what you are looking for is to search for the text inside each file from the folder.

  175. Chip says

    I notice that on your demo page the php page used is parse.php not contact.php

    Is there a difference in the code because it does not work at all using the files for the Basic you have for download or when I copy the code from the tutorial.

    • Gabriel C.Gabriel C. says

      Chip, parse.php is for the premium version of the script while contact.php is for the basic version. And yes, it is a big difference between these two.

  176. says


    I just bought the form and i would like to add this datepicker (http://jqueryui.com/demos/datepicker/)

    Is it possible and what do i have to do exactly?

    There should also be dynamic default values in my 2 date fields.
    arrival: tomorrow
    departure: tomorrow in 1 week

    And it shouldn’t be possible to pick a departure date before arrival and a arrival date after departure.

    Thank you for your help.


    • Gabriel C.Gabriel C. says

      First, you should include the jQuery UI file needed for this datepicker. Make sure you select the “Datepicker” checkbox when you want to make the inclusion. The second thing would be to call the datepicker (see “view source” for the example you want from the URL you just posted). The input boxes should have the ‘datepicker’ class. I hope you got the point. The most important is to view the sources for those examples and you will understand.

      PS: The developer version of this script has an example with date-picker integration. You can upgrade to that version if you are interested.

      • keoal says

        I have been able to implement the jQuery UI datepicker successfully on my form, is it possible to have any field using the datepicker set as mandatory? when I do this it trip the validation warning with the first action on the datepicker, e.g selecting the year and the warning only disappears after the next field is completed.

  177. Gabriel C.Gabriel C. says

    Broadcast for everyone:

    After countless hours of development, I am happy to announce you that I’ve released the AJAX Form Pro. It allows you to easily create unlimited forms in the same page or multiple pages, add multiple recipients that get the mail, integrate the form in a Lightbox and 2 sliders: ‘top slide in’ and ‘left slide in’.

    A demo can be viewed here:

    You can use the new script in any website that you own. The license is lifetime and you get free script updates for one year.

    Let me know if you have any questions. For those who are already customers and want to get the new version, I will send you tomorrow a special upgrade link.

  178. Kyle says

    How can I get it to sent to multiple addresses?!?

    $acf_conf[‘webmaster_email’] = ’[email protected]';

    I’ve tried

    $acf_conf[‘webmaster_email’] = ’[email protected], [email protected]‘;

    $acf_conf[‘webmaster_email’] = ’[email protected]’, ’[email protected]';

    etc etc etc etc – can’t find any documentation either.. maybe I’m looking in the wrong place?

    Any thoughts?

  179. janaranjan sahoo says

    Ihave found the code of Get Basic (Limited) in the download link.
    How can i found the code of the Get Premium (Professional) in the download link.
    I will be highly pleased if i get the code of the Get Premium (Professional) in the download link.Otherwise if possible please send me the code by email.

  180. says

    Hi, i’ve got a site and i want to change all the forms to a good system made. I like yours but i need to know somethings first.
    1. Can i check if a username or email already exists?
    2. I need to upload some images asociated to the form. Can i do it with ajax before the form is sent?
    If i didnt explain well you can check my site. Thx a lot.

    • Gabriel C.Gabriel C. says

      1. Yes, you can check it if you modify the script. You can use another script of mine that checks the availability of the username.
      2. The file attachment feature is on its way. I am working on it and planning to release it very soon (within a week). If you just need to upload images associated with the form (without sending them as attachments) you can do that too. I recommend Uploadify, a powerful jQuery File Upload Plugin Script.

  181. Charlie says

    I purchased your script and like it. I am having trouble however getting it to work outside the /examples directory. Everything works fine as long as I leave the page with the form in the examples directory.

    Anytime I try to move it to try and implement it into my main page index.php located in the parent directory, I cannot get it to work properly. I updated all links I can find but the form won’t work. What am I missing or doing wrong?

    As an example instead of ‘../ajax-form-app/common.php’ (in the page located in the examples directory)

    I have ‘ajax-form-app/common.php’ (in the page now located in the parent directory)

    What I am wanting to do is have the contact form integrated into my index.php page in the website root directory, without having to direct them to the examples/ directory because then I am no longer using index.php.

    I have searched this thread I could not find an answer and have spent hours trying to figure it out.

    • Gabriel C.Gabriel C. says

      You should follow the guidelines from the online documentation. Integrating a form in index.php is quite easy, especially if you analyze how each form was added in the sample files. Are you sure you are using the right form ID and the right path to make the inclusions? Send me index.php and common.php (from ajax-form-app) – via email – so I can check them and see what’s wrong there.

  182. Duncan K. says

    I have installed the script and I added to the form the date picker for a date field. The only problem is that it returns the US way of showing the date M,D,Y I need it to be the UK way – D,M,Y. Is there any setting I can change to do this?

  183. says

    Hi, Gabriel!
    I´m very pleased with the script and all its functions! I managed to localize almost everything (German), the last thing left is the datepicker. I found some hints via Google and got the language.js but couldn´t get it to work though. So I hope I´ll get some help here!
    Regards, SiGa!

    • Gabriel C.Gabriel C. says

      Isn’t the date-picker triggering? There are some examples of forms with the date-picker integrated in the “examples” folder (if you purchased the premium version of the AJAX form). Would you share the URL to the form so I can check if everything was installed correctly?

  184. says

    Hi, Gabriel!

    I purchased the extended version, used the make-a-reservation-template and the date-picker is working fine. I only need it to use German as language instead of English. Unfortunately I can´t provide a URL, the site isn´t live yet, I´m testing onboard (Xampp). So how do I add the de-language file for the datepicker (I already downloaded) in the right way?

    Regards, SiGa!

  185. Peter says

    I want to make a confirm email input field with validation(equalTo), how do I make that? I did edit the “parse.php” added

    if($afb_value[‘validation’][‘equal’] == 1) {

    if($_POST[$afb_key] != ($afb_value($_POST[$afb_key]))) {
    $afb_error[$afb_key.’_none’] = 1;

    but it doesn’t work, i want to check the equal between field.

    • Gabriel C.Gabriel C. says

      In the 'email_two' field add the ‘equal’ to the ‘validation’ array like this: 'validation' = array('equal' => 'email').

      In this case ’email’ is the field id of the ‘Email’ Field…

      if($afb_value['validation']['equal'] == 'email') {
      if($_POST[$afb_key] != $_POST['email']) {
      $afb_error[$afb_key.'_none'] = 1;

      I hope this does make sense. If you think you need help, I can connect to the FTP and do the necessary changes for you in exchange of a small fee.

  186. Adam says

    Hi Gabriel,
    I have purchased your script, and I’m having a problem. My form gets stuck on “Submitting…” when multiple forms are on the same page. Please open your demo at http://www.bitrepository.com/demo/ajax-form-pro/examples/multiple.php, fill in the form “Make a Room Reservation” and click “Send message”. Then “Submitting…” is continuously shown at the bottom, but the message is never sent (Tested in Firefox, IE and Opera) I have exactly the same problem on my website. Could you please help me?

    • Gabriel C.Gabriel C. says

      It gets stuck on submitting because you have an error in parse.php. I recommend you enabling the debug tool (in the form’s configuration file) to see what’s going on. Indeed, the form got stuck on “Submitting…” on the examples pages because it could not connect to my SMTP settings. Now, I’ve fixed it and it works. So, please do what I told you and let me know if I can further assist you. Good luck!

  187. Nima says

    Hi Gabriel,

    I’ve been playing with this for days, and I can’t figure out how to correctly link everything (so it seems). I get the error: The form file does not exist. I’m trying to load the form in the Fancybox window. The JavaScript behavior works just fine, but instead of seeing the form, I see that error.

    Would you like me to send you my entire folder so you can see how everything is linked and where the files are in relation to each other? I could try describing that for you, but that’s more painful for us both.

    I think I need to make changes inside common.php, but right now I’m hacking around without any finesse. I don’t exactly understand how to retrieve the basic.php file, which is why I think I’m getting this error.

    Your help/advice is much appreciated.



    • Nima says

      Update: The form shows up in the Fancybox window, but there is no styling, the text is partially inline and partially outside of the textbox, at the same time. captcha image doesn’t appear, and at the bottom, it says, “submitting…”
      What am I doing wrong. I feel embarrassed to admit that I’ve been working on this for days, and hours each day.

      Still awaiting your guidance.



      • Gabriel C.Gabriel C. says

        I am sorry to hear this. It looks like you didn’t set the right path to the files..especially to the CSS files..since from what you told me that’s the main issue here. You should have told me earlier about this, instead of spending hours on this. I can connect to the ftp where you form is located and make the required changes in exchange for a small fee, if you feel you can’t do it yourself.

    • Gabriel C.Gabriel C. says

      Most likely, you do not have the basic.php file (the form’s configuration file) in ‘forms_config’ directory. That’s why you see that error. Please take a look at the ‘examples’ folder to see how they are linked to the ones from ‘forms_config’. Yes, you could send me your files to my e-mail address. I’ll check to see what you’ve done there.

      • Nima says

        Here was the problem: The folder, “ajax-form-app,” and the file, “index.php,” were in the same (root) directory. To make everything suddenly work, in “common.php,” the following needed to be changed:

        $afb_conf[‘root_path’] = ‘../'; TO –> $afb_conf[‘root_path’] = ‘/';


        $afb_conf[‘script_path’] = $afb_conf[‘root_path’].’ajax-form-app/'; TO –> $afb_conf[‘script_path’] = ‘ajax-form-app/';

        In case this is not obvious to others as well, I’m posting here in hopes of making it easier for everyone else.

        Also, yes, “style-in-field-labels.css.php” must be linked to. Even though this is obvious, it was not mentioned in the documentation.

        My last, problem, Gabriel, is getting the email to SEND, successfully. I can’t manage to make it work. : (
        Please, uhm, what do I do? And where do I do it?

        Thank you for your help,


        • Nima says

          I should also mention what I have tried so far:

          In “basic.php” I’ve filled out all the proper fields for Email/UN/PW/Port/etc. I know the values are correct, because it works in Outlook 07. However, when I fill the form and attempt to send it, I get this error in debug mode:

          Could not instantiate mail function. {“status”:2}

          I can’t figure out what I’m doing wrong. Assuming I want the submitted forms to be sent to an email with a private domain, and not GMAIL, etc. what is it that I need to do?

          • Nima says

            Never mind. It works great, once I upload to the actual server. For some reason, it doesn’t work when running on xampp.

          • Gabriel C.Gabriel C. says

            Usually, sending mail does not work by default on localhosts unless you configure them to do that (you could also send mails through SMTP on localhost if you make the right configurations). I am glad you tested it live and got it work.

  188. says

    Bought the script 2 weeks ago, mailed you several times, but no response :-(

    I butchered the reservation-form: it gives a PHP error and I can’t fix it -http://qr.net/b7w2 (complete form) and the config-form: http://qr.net/b7xd – this is the text-version: http://qr.net/b7xh

    Also, would it be possible to integrate this plugin: http://qr.net/b7xj – as it looks better than the form-jumping in your script: people might not see the error-messages at the top and they have to scroll up and down.


    • Gabriel C.Gabriel C. says

      You didn’t close properly the main array – $AfbFormFields[$formId]['fields'] – at the end (after the ‘comment’ key). That’s why you see that error. Yes, that integration should be possible, but you might want to disable the real-time validation from the AJAX Form Pro script. Otherwise, duplicate errors might show and it’s not that nice for aesthetics.

      • says

        Got it to work – I used an online PHP-code checker and it told me the error was on a completely different line…

        Few questions: http://qr.net/b861
        1) I added ‘*’ in the labels of the required fields – as a visual indicator – I would like those ‘*’ to be red – and not within the label (which is the fieldname in the emails);
        2) I added ‘King of Bafuri room (Luxury)’ and want it to be a label only – fieldsize is 0, but it still shows some white/length – it should function as a ‘grouping header’ for the next fields, so I can reduce their label-length – basically it is a line only – but I don’t want it to be included in the mails – any change that is possible?
        3) Would it be possible to display the error-messages right of the fields – instead of underneath? That way the form is not stretched, users keeps seeing the fields he was filling out and doesn’t need to scroll – that would also eliminate the error-message at the top, as that might appear out of sight as well;
        4) Sending the form I get an error (‘method’), but both mails are delivered properly, with correct data – how do I debug that?


  189. Arek says

    I have a question. Incoming messages seend from page are with Polish characters but the descriptions of the name, message, send me a copy, etc.. on the web don’t have Polish characters.
    when I change the encoding to UTF-8 scripts stop working (captcha and fading descriptions).files are converts in notepad + +. What i can change and where? Sorry for poor English I am a beginner

    • Gabriel C.Gabriel C. says

      The script can’t just stop working because you have only changed the charset. Perhaps you did something else too that stopped the script from working again. The ‘utf-8′ charset is already set as the default chaset…Did you try to change the HTML page’s charset? I’d like to see the form in action if possible. You can give me the URL if you wish.

      • Arek says

        I have the answer.
        The problem is that a program which edits the php file (notepad++) is inserted at the beginning php file 3 characters “”.
        I do not see this in windows notepad, notepad++…..
        When I open the file in the php editor, surprise!!! I see something new “” :)
        I remove unwanted characters and everything is OK
        Thank you for your quick hint
        Your ajax form is the best 😉

  190. Matt Meaney says

    Hi, I purchased the extender licence and am trying to add an extra select field to the array of a copy of the ‘make_a_reservation’ form config (which already has a select field – ‘sender_subject’).

    I have successfully added other field types but as soon as I add another ‘select’ field the form (and most of the HTML) completely disappears from my contactus.php page. Please help!



    • Gabriel C.Gabriel C. says

      From what you are telling me, it could be a syntax error or a wrong added field in the ‘make_a_reservation’ form config. Do you have errors enabled for PHP? Make sure the “fields” array has the right syntax (no forgotten parenthesis or comma etc.). Please take a look at the other forms in the configuration folder to see how it’s done.

      PS: You can share the URL to the form, to see what happens when you add that extra field. I could tell you what’s wrong…if you still can’t manage to fix this, send me the configuration file (make_a_reservation.php) and I will check it.

      • Matt Meaney says

        I gave it one more try and it works now! Can’t think what I had done wrong, as I just copied the ‘sender_subject’ field array and then changed the selection options. Had done that before though. Maybe I had missed a comma or bracket! Thanks for the quick response.

  191. Matt Meaney says

    Hi again, I am trying to add a slide-in feedback form to my site. I presume I can use any of the form config files? However, having checked the ‘examples’ folder the slide-in form seems to require a lot more php code than the fixed forms do (and more than is shown in the documentation), and references files not even in the ‘ajax-form-app’ folder.

    Am I meant to copy all the extra files required into the folder I need them in, or are all the files I need for the slide-in already in the ajax-form-app folder? Thanks. Matt

    • Gabriel C.Gabriel C. says

      There are 2 additional folders for the Slide-In Feedback form: media (for the images) and js (which contains slide-feedback.js.php). So make sure you add these folders too (rename them if you wish) when including the Fancybox AJAX Form into any of the pages. It’s all about the paths here. That’s where many people are having problems. If you put the right paths, it should work without any problems. Hope this makes sense.

  192. Peter Nielsen says

    I am considering purchasing the premium script for use right now as a contact form, and would like to know if it is possible to incorporate CSS3 features, i.e. transitions on mouseover, box drop shadows, rounded corners, gradients, in the css code? It is for a danish website so danish letters ÆØÅæøå can be also sent I imagine? And one last question are the email addresses the form gets sent too, both the receiver and sender, protected from spambots, trolling by and snapping them up for spam mail? I know the captcha helps stop them from hijacking the form for their own nefarious uses, but are the emails the results are being sent to encrypted or protected in any way.

    Tankyou, hope to hear from you soon

    • Gabriel C.Gabriel C. says

      Yes, of course the CSS files can be modified so you can add the effects you need if you know how to edit them. Some effects can be achieved with jQuery, while others using CSS3 (note that not all browsers support it). The email addresses are not revealed in any way in the pages. They are set by you in the script and the data sent from the forms will end in the inbox of the receiver. The email text is sent in clear text (not encrypted). If you are using SMTP to send the mails through a secure connection (using SSL), then the data sent (including the password) to the mail server is encrypted through a digital security certificate, making it almost impossible to be stolen.

    • Gabriel C.Gabriel C. says

      Make sure you put the link the actual post and not the direct link to the download file [each time you are linking to any of the files from BitRepository].

  193. says

    Hi I purchased the developer version of this form a while back. It works great but for some reason I can get the ‘verified’ field to disappear on form submit.

    I even added my own jQuery to detect the hidden value and when it changes to ‘1’ then hide the div. However the hidden value only seems to change intermittently.

    everything working apart from this, is there a setting to get this field removed after successful submission. Heres a live example Form Example

  194. Jeremy says

    Deprecated: Function eregi_replace() is deprecated in /home/bitrepository/public_html/demo/ajax-contact-form/functions.php on line 20

    • Gabriel C.Gabriel C. says

      Thanks for telling me about it. I’ve just updated PHP with the latest version and some old functions are now considered deprecated. I will update the demo page for the basic form.

  195. Adam says

    Hi there,
    I was using the pro version a couple of months ago and it worked better than expected! However, now I’m trying to get the form to work with a new host and I’m having issues with the captcha image and the reload button; neither show up (as seen here: http://www.akrilic.com/contact-script.php)

    I’ve looked through everything I can think of and can’t seem to find the problem.
    If anyone knows of any mistakes that have caused this in the past, please let me know, I’d really appreciate it :)


    PS: Everything works fine when I disable the captcha in the ‘common.php’ file, but it would be great to get it to work somehow.

    • Gabriel C.Gabriel C. says

      Just took a look on that page you shown me. It looks like the CAPTCHA font can’t be loaded. Try to open http://www.akrilic.com/contact-app/captcha/image.php separately and you will see the errors. Make sure the font you are trying to use exists.

      If it still doesn’t work consider removing the following line:

      $captcha->ttFont = $afb_path_to_captcha_fonts.$config['tt_font'].'.ttf';

      This way, it will not use TrueType Font, but a standard font.

      • Adam says

        Thanks for the quick reply Gabriel

        Removing the line specifying to use the ttf font made the captcha show up – it works now! But unfortunately, this is a superficial solution. Whatever was causing the ttf not to work is probably the same cause behind the refresh icon not showing up (also, the formatting on the ‘send message’ is different than from what I remember)

        I’m pretty sure they’re all caused by the same issue, and whatever it is, is really frustrating me. I can’t figure it out. Any ideas?


  196. says

    How do I set a default value for radio-buttons?

    I tried this:

    ‘BafAdults’ => array(‘name’ => ‘Adults’, ‘columns’ => 3, ‘validation’ => array(‘radio’ => 1),
    ‘type’ => array(‘radios’ => array(‘baf-0′ => ‘0’, ‘baf-1′ => ‘1’, ‘baf-2′ => ‘2’)), ‘value’ => ‘0’),

    (set value at 0)

    but that doesn’t work. Any suggestions?

  197. says

    I use this for the subject line of the auto-response message, and it works fine:

    // AutoResponder Mail Subject
    ‘ar_subject’ => ‘Your – enquiry – arrival: {arrival}’,

    However, using a similar line for the admin-mail, the placeholders are not filled with the actual field-values:

    // if the ‘sender_subject’ field is not set, then add a custom mail subject
    ‘custom_mail_subject’ => ‘Enquiry from {last_name} for {arrival}’,

    The admin-mail literally has this subject: ‘Enquiry from {last_name} for {arrival}’ (without the quotes – it is treated as text only – not as placeholders)

    How to fix this?

    • Gabriel C.Gabriel C. says

      Take a look at the example and view the source code. You will notice that the trigger buttons have specific IDs that are referred in the JavaScript code that opens the Lightbox/Slider.

      • Immer Online says

        …moved the files from EXAMPLES to the root folder and updated the links, also the files in the JS folder. The ordinary forms works but not the lightbox ones (links). Guess I missed something…

      • Immer Online says

        Bought the package at Code Canyon
        and installed it without changing anything, besides adding ‘from_email’
        and ‘from_name’ in the config-files.
        Still can’t get LIGHTBOX to work,
        what am I missing ?
        Regards – Immer Online

        • Gabriel C.Gabriel C. says

          Yes, you must have missed something important. Please share us the URL to the pages that have the form with lightboxes. I can tell you very fast what’s the problem: you need to use the right ID that is triggered in the JavaScript code. The Fancybox should load. It has support for many browsers. It’s one of the most popular lightboxes out there.

          • Immer Online says

            Thanks for your reply. I agree with you that the Fancybox is a cool feature and I would like to get it to work. For test purpuses I put the package here:
            Regards – Immer Online

          • Gabriel C.Gabriel C. says

            Checked the URL. The paths to the jQuery file and the CSS files are not properly set. As you can see, if you view the source code and try to load the jQuery file (the path that it’s set now) you will see that it doesn’t work. Please send me privately your common.php and I will take a look at it and tell you what has to be changed there. You must have typed a wrong path there.

          • Immer Online says

            Thanks for the hint Gabriel!
            Fixed the “$script_path” and now its working. GREAT.

  198. Keoal says

    I was looking to track how many times the form was submitted in Google Analytics in order to set up a funnell, obviously this poses some problems as the form is AJAX and has no thank-you.php page, I managed to figure out how to do this so thought I would share it, it seems to be working fine so far.

    so if anyone needs to track when a form has been successfully submitted in google analytics (you must be using asynchronous tracking first) change the following in the acf.init.php file at around line 157 and after the following code: <?php if($acf_conf['custom_thank_you_url'] === false) { ?>

    enter your GA virtual link:

    // Google Analytics Tracking for form submission
    _gaq.push(['_trackPageview', '/form-success.php']);

    now when anyone fills out the form it will appear in your top content in GA.

    if you want to track how many times the submit button was pressed but not submitted successfully enter your GA virtual link inside the <input> for the submit button:

    <input id="acf_submit_button" class="acf_button" type="submit" name="submit" value="<?php echo $acf_conf['send_message_text']; ?>" onclick="_gaq.push(['_trackPageview','/virtual/customer_services/contact-form-submit']);">

    • Gabriel C.Gabriel C. says

      Thank you for sharing us this integration. I suppose the feature to redirect the user to a thank-you.php page after submit was not a feasible option for you, since you could have added the Google Analytics code on that page. However, most of those who are using AJAX Form Pro are not using the feature and prefer to keep their visitors on the same page. So, I hope your comment would be helpful for those who are looking to setup a funnel.

  199. jonatahn says

    Hi,I just paid for AJAX Form Pro.
    But attachment on lightbox is not working! when i click on it nothing happened?
    I use contact from example folder.
    any help please.

    • Gabriel C.Gabriel C. says

      I would to check the URL to your page and see what’s going on there. I can tell you what was not done right. It might be the fact that you didn’t set up the right path to the JavaScript files.

  200. Johnny says

    Hmm I need to put two contact forms on the same page,go to 2 different email addresses trying to make sure I have no conflicts. any idea what file I should edit?

  201. says

    I bought your tool for sending email.
    Please, I want to save the form data into a MySQL database table
    You can guide me how to do this?

    • Gabriel C.Gabriel C. says

      Sure! You need to edit the file parse.php that sends the form information to the email address of the webmaster.

      Look for the line:
      $afb_error['status'] = 0;

      After it, add the code that inserts the information to the database. Write me privately if you need more assistance.

  202. Julie says

    I am searching for a form tool that creates & processes. This one looks very promising! The form needs to support end user submissions that will be stored to a database and emailed to an admin. Only three fields are needed: Email, Subject & Comment.

    Is this tool able to do this out of the box? If not is customization as a purchased service available?


    • Gabriel C.Gabriel C. says

      @Julie, the script can create the form you want. However, it doesn’t have the feature of adding the data into a MySQL database. If you purchase the extended version of the script, I will add that customization for you (add form data into database and page to see the data that was previously inserted).

  203. emre a says

    Well, I just purchased the developer version today and applied to one of my client’s web page and I can tell this will save me some quality time on my other projects as well :). Thank you for putting this together. It is def. worth for the money.

  204. guntram says

    hi dude!

    i was experiencing an issue with checkboxes on your premium version of the afp.

    i was stuck with false option values getting setted if i use dropdowns.

    so the html was something like:

    Technical Question

    the solution was, after a lot of checking out ;), that i have to set the layout to 1 instead of 3…

    this brought me to the desired output of:

    Technical Question

    i am using this on a facebook app!
    on a usual webpage this issue does not appear somehow!


  205. guntram says


    if the datepicker is empty and you set the option to validate it, the form shows the error and does not submit.

    but i did not want this to be an option so i just setted the datepicker to a start date so that there will always be a date picked and the user can only change it.

    if you concentrate on that a little, you can also check if the user deletes the field and set a date again into the field.

    don’t know if you can verify a certain date frame, but i think you can set the datepicker itself to some range of valid dates…

  206. guntram says

    sorry for the frequency of my posts right now :(

    but i wrote
    “i was experiencing an issue with checkboxes on your premium version of the afp.”

    of course i was experiencing an issue with dropdown-select boxes and not with checkboxes!!

  207. Chris says


    Can this be used on Microsoft-IIS/7.5 Server?

    Clearly a lot of these forms integrate with Linux php mail and the Sendmail program.

    But Ive been asked to host on Microsoft-IIS/7.5 Server. I believe it has php installed but uses SMTP only.
    Ive no experience of Microsoft-IIS/7.5 Server.

    Honest feedback required because im happy to pay a fix if it can work under Microsoft-IIS/7.5 Server

  208. Thomas says

    Hi Gabriel,

    Great script! Purchased the Pro version and am very happy. Couple of questions:

    1. Can I set a hidden field in the form?

    2. Is it possible to do inline Ajax validation, i.e. is user name already in a database etc?

    Many thanks, Thomas

  209. Ray says

    I had some problems getting this to work on IE, but recently got it working. I like the functionality and cleanliness of your basic form and have modified the CSS to my own needs.

    Then I decided to upgrade a contact form with this one. This form would be nested in mb_container, only that plugin uses newer Jquery and I can’t get them to play nice. Your demo files used jquery.1.2.6-min, I tried a version four and a fiver, which work for the container, but they don’t animate the notifications of your form. My setup looks too PRO to go back, so what are my options? Can you think of something I would need to update to get this to work with newer jquery libraries?

    Great work otherwise. Kudos.

  210. Matt Meaney says


    I purchased the extender version back in June this year. I can’t seem to find any documentation or example of using the attachment upload feature. Please can you help me? Also, are there updated versions of the scripts available, as I think I read you did some sort of update in July?


  211. Salvage C says

    Hello, I have two questions before I buy this. 1) I downloaded the free form and I realised that the email that it sends, doesn not have subject nor sender nor header.Why is this? Is the premium one different? 2)About Developer License: Does it mean I cant use the form in a site I design for clients? It says unlimited and unlimited hosts so I should be able to use it on clients sites, no?

  212. Mike says

    Hi Gabriel

    Impressive script, and the form exactly what I have been looking for. But does appear to be for developers and people who know how to write code.

    Fopr someone like myself, who has limited experience with websites and code, the comments posted are scary, if they have problems with the code then a layman definitely will.

    Your extended version explains you will configure and upload 2 forms to 2 websites, but does not explain how this script comes, is it a complete form then it gets modified? Not enough information for people like myself who like your script and forms to purchase and not know if there is proper help afterwards

    Kind Regards


  213. says

    Thank you for sharing us this integration. I suppose the feature to redirect the user to a thank-you.php page after submit was not a feasible option for you, since you could have added the Google Analytics code on that page. However, most of those who are using AJAX Form Pro are not using the feature and prefer to keep their visitors on the same page. So, I hope your comment would be helpful for those who are looking to setup a funnel.

  214. Marcel Fellmann says

    Hello Gabriel
    I bought the tool and it works like I wanted it. But now I need the function to enter data into a mysql database. Can you help me here?
    Did you give me a sample code. As I read this to be entered into the parse.php.

  215. Marcel says

    … and I’ve got another question: how can I put two text fields next to each other? Example: ZIP and city or first name and last name. is this possible. Excuse my bad english, I hope you understand what I mean. German would be better to describe correctly all.

  216. Vishal says

    We bought a licensed version for this. We are trying to use this on a site and it keeps showing the Submitting icon after clicking submit. The email is triggered and all data validated. How do we redirect this to some page or how do we ensure the Submitting actually completes its action? I am not much of a programmer.

  217. franco says

    I have bought your script. I will need to display fields (say: input,select, ect.) in two colomn – one beside other.
    Is it possibile?


  218. Joseph says

    Hi Gabriel
    I just purchased the single license. I would like to know if it is possible to upgrade to the extended license?
    Kind regards

  219. says

    This is a great application. But Gabriel you prommised me a database “updated version” last year already. Up to date I am getting no response from you and can also not download the aplication any more.
    Please help

    • Gabriel C.Gabriel C. says

      Llewellyn, thanks for getting back to me. It took me a while to release the new version of AJAX Form Pro and believe me, you will understand the reason you had to wait when you will use the new script. My apologies for the inconveniences this delay might have caused to you. I’ll send you the new tool right away 😉

  220. Joe says

    Why such an increase in the price? The single license was $17US less than a month ago. Same thing with the extended license, increasing from $67 to $127.
    Personally I think it’s a bit too much.

    • Gabriel C.Gabriel C. says

      Thank you for your comment. I’m not sure you’ve noticed, but AJAX Form Pro v2 with Control Panel was launched that is a far better web app than the previous version. It basically allows you to easily create as many forms as you want and integrate them into your website in a couple of minutes. I’ve spent months developing and testing the new application (fixing bugs, adding new features, improving code quality) which is even today in a continuously improvement. I personally believe the $27 price is not much at all considering that you get a lifetime license for a fixed price, which you can use to create as many forms as you wish (unlimited submissions) on a single website. If you take a look at some “Online Form Builders” out there, you will see that they charge you a monthly fee and you keep the form on their servers. It’s like using WordPress.com to host your blog instead of having your own server with the WordPress platform customized as you wish. The “Extended” license lets you setup as many forms as you wish in unlimited projects for your clients. If you are a Web Developer that needs to constantly create forms for his customers, then I believe $127 is an convenient price. You can even include the script in commercial scripts. The only thing you can not do is to resell it and claim the script as yours.

      PS: The new version was just launched and I’m offering discounts for it (check the latest post on the website). If you are an existing customer, I can offer you a special discount for any licenses you might need.

  221. CC says

    I just learned about this today but $127 is really steep for a form processor. Any chance of a sale coming soon?

    Also, does this use the popular Bassistance.de validation plugin? That’s the one I’d like to see integrated the most. I have several form scripts that use it and it’s the best so far. In your demo you seem to check for numeric, text etc but nothing to validate credit cards etc.

    • Gabriel C.Gabriel C. says

      I might decrease the price for the “Extended” license in the near future. The other prices will remain the same. I’ve explained my reasons in my above reply.

      No, the script does not use Bassistance.de validation plugin. It has its own validator. Credit Card validation is not implemented, but I am thinking seriously in adding it. One step at a time 😉

  222. maruf says

    Parse error: syntax error, unexpected ‘@’ in /home/a2593233/public_html/contact.php on line 52

    i am getting this error message,
    can you help me please

  223. Marnix says

    Is it possible to use the file upload form on a smartphone?! I tested your example “Advanced Contact Form” to Add Attachement, but this didn’t worked. I select an image, clicked Upload Files(s) and then it stopped.
    Which php version do I need 5.2+

  224. says


    I have used the simple contact form on my site. Everything validates and I have followed all your instructions but when I send test messages, they never come through and it confirms that the message has been sent…I have no idea what could be happening…Any chance you can help out?


Leave a Reply

Your email address will not be published. Required fields are marked *