HTML contact form with CAPTCHA

Using a contact form on your website is very useful as it helps your web site visitors to communicate with you in an easy and simple way. But, there are spammers and hackers who are looking for exploitable web forms. It is essential to secure your form against all ‘holes’ that those hackers are searching for.

Note:Using Simfatic Forms you can build awesome contact forms in minutes. No coding required. Drag and drop build the form and and get it online fast. Supports CAPTCHA. Download the Full Featured Version of Simfatic Forms here

How does the spammers/hackers exploit HTML forms?

Spammers exploit web forms for two purposes:

a) As a relay for sending bulk unsolicited emails

If you are not validating your form fields (on the serve side) before sending the emails, then hackers can alter your email headers to send the bulk unsolicited emails. (also known as email injection) For example, hackers can place the following code in one of your form fields and make your form processor script send an email to an unintended recipient:

The code above is adding another email address to the CC list of the email. Spammers can send thousands of emails using this exploit. Your host will not be happy with this and may warn you or even ban your web site.

The best way to prevent this spammer exploit is to validate the fields used in the mail() function(fields like email, subject of the email, name etc). Check for the presence of any “new line” (rn) in those fields.

b) For Sending spam messages to you

There are programs known as ‘spam-bots’ that leech through the web pages looking for web forms. When found, those ‘bots’ just fills the fields with a spam message and submits. Eventually you will start getting many hundred submissions send by those spam bots and you will find it difficult to separate genuine submissions from spam messages.

The solution for this problem is to use a mechanism to identify human submitters from ‘bots’. CAPTCHA is one of such tests.

Adding Captcha to the form

Captcha is an image with a code written on it. The website visitor is required to read the code on the image and enter the value in a text field. If the word entered is wrong, the form submission is not processed. As CAPTCHA is a smartly blurred image, the spam bot can’t read it. So the form cannot be auto-submitted by a ‘bot’.

The contact form with CAPTCHA

Here is the HTML code for the contact form:

<form method="POST" name="contact_form" 
action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>"> 

<label for="name">Name: </label>
<input type="text" name="name" 
value="<?php echo htmlentities($name) ?>">

<label for="email">Email: </label>
<input type="text" name="email" 
value="<?php echo htmlentities($visitor_email) ?>">

<label for="message">Message:</label> 
<textarea name="message" rows=8 cols=30
><?php echo htmlentities($user_message) ?></textarea>

<img src="captcha_code_file.php?rand=<?php echo rand(); ?>" 
id="captchaimg" >
<label for="message">Enter the code above here :</label>
<input id="6_letters_code" name="6_letters_code" type="text">

<input type="submit" value="Submit" name="submit">

The HTML form above contains the fields for name, email and message. In addition, we have the CAPTCHA image. The <img> tag for the CAPTCHA image points to the script captcha_code_file.php. The PHP script in ‘captcha_code_file.php’ creates the image for the captcha and saves the code in a session variable named ‘6_letters_code’.

Validating the CAPTCHA

When the form is submitted, we compare the value in the session variable(6_letters_code) with the submitted CAPTCHA code( the value in the text field 6_letters_code). If the codes match, then we proceed with emailing the form submission. Else we display an error.

Here is the code that does the server side processing:

  if(empty($_SESSION['6_letters_code'] ) ||
    strcasecmp($_SESSION['6_letters_code'], $_POST['6_letters_code']) != 0)
      //Note: the captcha code is compared case insensitively.
      //if you want case sensitive match, update the check above to
      // strcmp()
    $errors .= "n The captcha code does not match!";

    //send the email
    $to = $your_email;
    $subject="New form submission";
    $from = $your_email;
    $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
    $body = "A user  $name submitted the contact form:n".
    "Name: $namen".
    "Email: $visitor_email n".
    "Message: n ".
    "IP: $ipn";  
    $headers = "From: $from rn";
    $headers .= "Reply-To: $visitor_email rn";
    mail($to, $subject, $body,$headers);
    header('Location: thank-you.html');

Customizing the CAPTCHA

The CAPTCHA script in the sample code download can be customized. If you open the script, you can see the first few lines of the code as shown below:

$image_width = 120;
$image_height = 40;
$characters_on_image = 6;
$font = './monofont.ttf';

//The characters that can be used in the CAPTCHA code.
//avoid confusing characters (l 1 and i for example)
$possible_letters = '23456789bcdfghjkmnpqrstvwxyz';
$random_dots = 0;
$random_lines = 20;
$captcha_noise_color = "0x142864";

You can change the size of the CAPTCHA by changing $image_width & $image_height. The number of characters in the CAPTCHA can be changed by updating $characters_on_image. Similarly, the text color of the CAPTCHA can be customized by updating $captcha_text_color. The code adds some ‘noise’ in the image by adding random lines and dots. you can increase or decrease the noise. Please note that increasing the noise may make it difficult for your genuine visitors to read the code.

Download the code

Click here to download


The above captcha code is based on the code developed by Simon Jarvis:

Posted in Contact Forms Tagged with: ,
161 comments on “HTML contact form with CAPTCHA
  1. ahmad says:

    Very Great Article
    but I dont know why $_SESSION['6_letters_code'] doesnt work form me

  2. ahmad says:

    I found the error why $_SESSION['6_letters_code'] doesnt work
    I was missed session_start on check php ( you can add it )
    thanks again

  3. R says:

    Where do I need to place the session_start in order to get it working?

  4. don says:

    Ok Figure it out…   Also have to add php gd support for apache2.

  5. webdeluxe says:

    Thanks, i was just looking for this Captcha thing, thanks for showing us the code.

  6. Danny says:

    I love this code, it’s easy to implement and is nicely readable but still obscured.

    The only question I have which others may agree with is how do I make it so it remembers the forms content should the captcha code be wrong? I’m sure it would be very frustrating to users if once they’ve filled out their information and message only then to have to put it back in.

  7. ti ti says:

    Email was sent, but the thank-you.html  file was not reached.  What is wrong with your codes:
    $headers = "From: $from rn";

    $headers .= "Reply-To: $visitor_email rn";

    mail($to, $subject, $body,$headers);

    header('Location: thank-you.html');

  8. Chris says:

    How do you impliment radio and check boxes with this form? An example would be great. Thanks!

  9. Fergal says:

    Hello all, Im not an internet guru but know a little of website building…ive built this website but am having problems with the captcha form…the captcha image seems to work but all the text feilds show <?php echo htmlentities($user_message) ?> in them in the browser…am i doing something wrong ? and alsa at the top of the contact us form “.nl2br($errors).” …”; } ?> seems to show when viewed in the browser…this is day 3 of trying to work out how to do a captcha form …been utubing it…googling it…trying everthing…time to buy a good solid rope and go tree hunting 🙁

    • Prasanth says:

      Do not copy & paste PHP code to an HTML page.
      See how to embed the form

    • docj says:

      Not sure if this is your problem, but for the benefit of others: if you want to run php locally you need php and server software (e.g. xampp) installed.

    • heather says:

      I am having this same issue. I have tried everything, what am I doing wrong?

    • Allen says:

      You can’t put php into a page using an .htm extension.  Even though the page may be mostly html, the file must be using a .php extension or the server won’t know to look at the php as code and interpret it.  It will just pass it along to the browser as plain text.
      Php code is embedded into the html as part of the content of a .php file, as in the following line:
      <img src="captcha_code_file.php?rand=<?php echo rand(); ?>"
      This part of the above line is php code: <?php echo rand(); ?>
      The rest is html.  So...You need to know a little about using php.

  10. Fergal says:

    ive left the contact form that ive attempted online. Go to the contact us page to see what im on about…cheers…

  11. Gary says:

    I was so glad to find this tutorial. I am having an issue. I get
    the following message:

    The captcha code does not match!

    Not sure why this is happening.

  12. Patrick says:

    hello i got the form working fine all the headders apear but the message dont appear any ideas on that thanks for form.

  13. Joanna says:

    please could a very kind person explain exactly where I add all this code, I’m new to this and i think my head will explored if I try and figure anymore out tonight.

    I have a contact form on my site but I need to add a captha to stop the spam emails.

  14. Gloria says:

    Grateful for a little help:
    How can I redirect to a different thank-you page?
    Fantastic product, btw. Thank you!

  15. Mike Madrid says:

    You can change the thank you page at the bottom of the script.  The line reads:  header(‘location:thank-you.html’); 

    Change the thank-you.html to whatever page you want to load AFTER the form is submitted.

    Anyone know why my form is not sending emails?


  16. Ashton Lopez says:

    Hello, I have a static website in HTML, please explain me how can i embed this code in my html page.If it possible then please provide me the steps to be followed during this process.
    Thank You!!

  17. Pat says:

    I am also new to this and am wondering where I place the code that starts the server side processing. Does it go on the same html page (and where? In the <head> tag?)? Or do I need to save it as a separate file and put it somewhere else? thank you!

  18. Matt says:

    I notice an issue when adding a drop-down selection to this form. If you fill out the name, email and choose a drop-down item and click submit without inserting the captcha – it erases the drop-down selected item back to default. Does anyone else know how to fix this?

  19. Harv says:

    I’m testing this out and it appears to work great, I just don’t get the information emailed to me. I changed the $your_email to be my own email, but didn’t get it.
    Any suggestions?

  20. Leigh says:

    Hi there, thanks for the script.
    I am trying to implement it on my website, as I have an existing quick enquiry form with form validation, but i have been getting alot of spam in the last 2 weeks, so wanted to add Capthcha…
    This is my existing quick enquiry form:
    I am trying to make it work on this test page using your script:
    But its not giving me the errors? (validation?)
    I would actually prefer if the error messages either came underneath each field OR in an alert box.
    I also dont wnat to be taken to a thank you page. Perhaps just a “Successful message” would be good.
    Any advice?

    • Prasanth says:

      Please try removing the EnableOnPageErrorDisplaySingleBox(); line

      • Leigh says:

        Thank you Prasanth, that worked!
        But how do i get the form not to redirect? is there an easy solution? Usually i would want it to redirect, but in this case of a quick enquiry form, i dont want the person to be redirected to another page.
        Many thanks in advance!

  21. Bob says:

    I cannot find which line I have to edit my email address in the contactform.php?

    Thank you

  22. John says:

    to Bob
    $your_email = “”;
    //send the email
    $to = $your_email;

  23. indiumite says:

    Nice codings …….. its very useful to me………

  24. chris says:

    Hi there was using this and all seemed fine working and then it stopped working after i had sent this through quite a few times? is this becuse it blocks my ip after several attempts??? im really confused and for some reason the same script that wont work will work on a diff server?

  25. chris says:

    in regard to my above comment i think it was a hosting problem on my end, superb bit of code, just what have been looking for cheers!!!

  26. Tom says:

    I implemented the form and it all works apart from the email validation. if I enter an address without ‘@’ it still sends it without error.
    Is this desired to work like that?

  27. Kevin Li says:

    hello, I have downloaded all of your files and it works well, but I can’t seem to find the way for all the pages to integrate together, persay, how do you make the captcha files work with the html contact form?

  28. Kevin Li says:

    Also, I can’t seem to open it in Dreamweaver CS5. Is this normal?

  29. Henry says:

    I tried to change the id from 6_letters_code to letters_code ( all 5 of them, 3 from comparing and 2 inside <input … >) to pass HTML validator  but it doesn’t work after. I’m wondering why that would happen.

  30. Preston says:

    Excatly where do I place these pieces of code?  Thanks

  31. Agustin Ponce says:

    so i tried putting this code on my contact form, but for some reason no captcha picture is shown…like it doesnt display anything. What could be my error?

  32. suardana says:

    how to instal html contact form php in the web page?

  33. king says:

    Hi, I Wish You for good work and  i wanna know
    How to add phone option with numeric form validation. pls Mail Me

  34. Greg Surkis says:

    Thank you, looking for a captcha on your site, this most liked=)

  35. Som says:

    Validation is working but Cpatcha picture is not showing………………
    Please help me.

  36. Ali says:

    When I add the css coding most of the rest of the css and Html goes sickly green. What is wrong? And also where is the caphta image?

  37. sam says:

    You need php-gd to display the captcha.

  38. Andrew says:

    I have added the code but when the image is displayed there are no letter/numbers. The lines show fine and the picture is generated ok. I tried to comment out the 6 character generator and just hardcode the $code variable but that didn’t seem to work either. Any ideas? Thanks in advance for your help.

  39. Andrea says:

    So this was relatively easy to follow, and had almost everything that I needed to make a form work. BUT I need an upload file button too. (Just for images) As this is a contest submission that I just want emailed to me. I tried to pull from another page… …but I have no idea when it comes to PHP.
    SO now I am getting an error  “The uploaded file is not supported file type. Only the following file types are supported: jpg,jpeg,gif,bmp” and I havent even done anything but land on the page to see if it worked. (Yes it is live)
    Not only that but there is nothing showing up in the captcha. and I have no idea what php-gd is or where to find it.
    Please help! I have tried everything and cant get the plugins on wordpress to work, so I have to do this manually… and NOW that isnt working either!!  @.@
    Thank you for any help!

    • Prasanth says:

      You have to remove the validation that allows only files of type jpg,jpeg,gif,bmp (search for the error message in the HTML page and remove the corresponding line)
      you can ask your hosting service to enable GD library for PHP

      • Andrea says:

        Awesome, I will do that!
        THANK YOU!!! 😀

        • Andrea says:

          I got it to work… I am getting emails and can confirm the form… BUT
          I need to receive the attachments that are supposed to be with these emails. They’re not coming through. Can you help? 
          I followed the instructions for the attachments email form on the page, but when in Pear I couldnt find the mail and mail mime files. I like the simplicity of this script much better,
          Thank you for your help! You have been great so far. I know I must be bothersome being such a noob at PHP programming.

  40. Andrea says:

    Please ignore my previous silliness!
    I dug a little deeper into your amazing website, and discovered EXACTLY what I wanted. You are the best, thank you for programming these wonderful PHP’s and helping me when I was being quite silly.
    Have a great day!

  41. Darren says:

    Hi, I have been using this contact form for a while and it was working great, unfortunatly my host has disabled PHPMail on my server and I have to use a script with SMTP authentication. Is their anyway to adapt the script I have been using as I have the form looking exactly how I like it, and its been a great little form until my hosting company decided to drop support for PHPMail. Many thanks in advance to anyone who can help.

  42. una says:

    I tried the form on my local server but I got the following message.Does anyone know what this means?
    Any help fixing this would be much appreciated. Thanks
    Deprecated: Function eregi() is deprecated in C:wampwwwsimple-contact-form-1-2includefgcontactform.php on line 548

    Deprecated: Function split() is deprecated in C:wampwwwsimple-contact-form-1-2includeclass.phpmailer.php on line 470

    • This is because you have a newer version of php installed and they have changed the function to run regular expressions, if you search php net for eregi it will tell you the replacement cant remeber exactly that is just a quick name change, and do the same for the split function.
      Andrew Townsend
      Exclusive Web Systems

  43. Thanks for the useful advice and tips.
    I am sure many of us, laymen would benefit from it.

  44. Fiesta says:

    It’s working fine for me.
    You’ve saved me hours of writing code.
    Thank’s a lot you do a great job!

  45. Fiesta says:

    Everything is working fine for me, except:
    1. An email with nothing between @ and . eg: doesn’t post an error message.
    2. When the message field is empty I dont get the error message.
    How can be fix it? Thanks a lot.

  46. Glen says:


    I’m getting a ‘Validator’ is undefined error….. How can I clear this?



  47. The fact i prefer around your website is you often article immediate to the point details.

  48. I have been using a template to create my site.  I have a banner on all my pages.  I€™m ready to create my contact.html page (in fact, it is all ready) I need to put a contact form on this page of my temple.  I don€™t know where to place the code within the code view (Dreamweaver CS4) or where to add or put the contactcss or php code for the form to work.  I know I sound lost, because I am.  Please help

  49. You really make it seem so easy with your presentation but I find this topic to be really something which I think I would never understand. It seems too complicated and very broad for me. I am looking forward for your next post, I will try to get the hang of it!

  50. Glen says:


    I got it all working, but today when I went to my site the CAPTCHA image isn’t showing anymore. I haven’t changed anything….. What might have happened?


    • Glen says:

      Never mind, I recopied the captcha php file and it cleared the error. Not sure ehat happened for it to stuff up but it’s fixed.

      But on another note, if I want to change the colour of the text in the image to white, which part do I change in the script?


  51. The script works great for CAPTCHA.. the problem however that I am having is that Name and Visitor’s Email does not come through on the sent email. Also, the name or email address is not passed to the headers so when I get the email it comes as being from something like
    If I pull the <?php echo htmlentities($name) ?> and <?php echo htmlentities($visitor_email) ?> lines out and leave the values blank then I get the entries in the form email and the email will come from “”.
    I’ve tried both visitors_email and email for the address that the visitor enters with the same result.

  52. Paul Markey says:


    I have set up the contact me form and it keeps on coming up with invalid e-mail adress even though I know it is correct ??

    Any ideas

  53. Mo says:

    Well, I’ve got it uploaded to my host and the captcha works, and so does the Thank You page.. but I’m not receiving the emails. I changed the “$your_email =’’;// <<=== update to your email address” line so that is my address that I want it sent to. Any ideas? Thanks!

    • Berentank says:

      I got the same problem here…
      but has it to be the e-mail adress of the host, were the file is uploaded?

      • Kay says:

        Interesting….i changed the email address where I wanted to go to my hotmail acct and it came thru. with a message that said it looked suspicious but it came thru. Is there anyway to get my server to not block it?

  54. Kim says:

    Having the same problem as Mo. I thought I was doing so good. We are almost there. Help please. Thanks

    Mo – ”
    Well, I€™ve got it uploaded to my host and the captcha works, and so does the Thank You page.. but I€™m not receiving the emails. I changed the €œ$your_email =€™€™;// <<=== update to your email address€ line so that is my address that I want it sent to. Any ideas? Thanks!

  55. Hi
    Amazing stuff by the way, just trying to use on my holding pages, only one problem. Its all looking amazing, but when you press the submit button nothing happens it just refreshes.
    What am i doing wrong! grrr

  56. Elena says:

    I added the fields in the contact form and everything works.

    But now I want to add 2 radio buttons, each with a yes and no.
    How do I insert the radio buttons.
    how do I create the control is active on yes so that form send, otherwise if the locks do not



  57. Brent says:

    Great form I like it !
    One quick question (I hope)
    How would I setup the gen_validatorv31.js to check validation of a phone number?
    Thanks Again,

  58. Brent says:

    One last question if you have time.
    How do I add a Cc or BCC to $your_email =’’;//

  59. Gabriel says:

    How can i format to this form?

  60. melissa says:

    Thanks i am now able to create my forms, i really appreciate your site

  61. Cindy says:

    How can i add images to my form? How can i make certain input be limited like on my form i asked for phone number i want to make sure the maximum digit is 10 how can i do this?

  62. Sam says:

    Testing out the contact form sending forms to my own email address, after a couple of successes, it started going to junk mail and warning me it may not be genuine. can you help with this matter please.

  63. 0161-Jon says:

    script looks great thanks. The captcha image isn’t displaying though, have I to change a path somewhere as I cannot see where this could be? All I get is a broken image symbol.

    • Prasanth says:

      The captcha image is generated on the fly. Copy the captcha image link and past in your browser’s address bar. it will show the error message that is causing the problem

  64. dataxploit says:

    good post,,,,hope 2 some more

  65. Shady Aggrey says:

    Thanks alot. The captcha was very healpful and worked very well for my website

  66. Amber says:

    AMAZING! Love it! I’ve been looking for days for something like this. I’ve customized it with CSS a bit and placed it into a website I have.

  67. saba says:

    Even if I type in incorrect captcha it still sends the form. what can be the issue

    • Azhar says:

      saba. use your ability of work for a while and setup a programming intermediate level code. using if statement. not understood.

      use , if(code is wrong) {
      do this
      } else {
      do something else

      hope now you learned it 🙂 nice but little tricky question :

  68. Joe says:

    I was hoping someone could help me with my contact/CAPTCHA that I am trying to figure out. I have followed the instructions and believe everything is done correctly (uploaded the files as directed and filled in proper info), or so I thought. There are some punctuation that shows up in front of the form that should not be there and captcha doesn’t even show up. The site is

  69. Amber says:

    Great code!
    However there is one thing, the submissions go to my junk inbox instead of my actual inbox. Is that to do with my email junk folder set up or is there something I can change in php?

  70. Where exactly is “javascript: refreshCaptcha();” function??? Can’t find in “Scripts/gen_validator31.js” or anywhere else in download for that matter.
    Pls help.
    thx in advance,

  71. Robert Sharp says:

    This comes from using a html editor without knowing the underlying html.

    If you look at your page source code,
    You see the beginnings of your table.

    ; ; ?>'

    The issue begins just after LAST QUOTE first line. You have a –> end of comment ling which is not shown.
    The next line starts out with a ; semicolon then the hiddne field and at the other stray characters.

    Simply edit the form fields and then you would be done.


  72. JT Hutten says:

    Thank you so much… very helpful. Jedidiah

  73. chhabindra says:

    Thank you

  74. Serque says:

    CAPTCHA can bypassed by
    1000 captchas for only 1$ !

  75. Karl Dallas says:

    I assume I can’t use this form in a WordPress.Com or WordPress.Org site. If not, do you know how I can add a Captcha form to WordPress.Com? I know how to do it in WP.Org.

  76. jeff says:

    Is this code compatible with IIS? Thanks!

  77. Stewie says:

    Great form, got it working in no time. Exactly what I was looking for, Captcha authentication works a treat against Spam.

  78. Steve (UK) says:

    Code tested, working fine with added attributes but when pasted into web page, value=” appears in lable/text areas! Have I perhaps overlooked something? At a loss, help much appreciated. See: (works fine) ; = value script in text areas!

  79. Thomas says:

    This Form script is nice, but the email is not send out! I have already check with example code ( and this is working withoit problem, just this form script here does not send emails.

    Anyone can help?

  80. Scott says:

    Looked ta a whole lot of captcha samples that claim to be simple and this is the only one that was.

  81. Cory Doyle says:

    Love this script, but I just keep getting captcha code does not match! How is this possible, even when I load the download untouched up to my hosting server I get the same thing over and over, any advice would be very helpful. Thanks

  82. Ali says:

    Was help full for me!
    tanks dear

  83. Harish says:

    captch images are dosnt display…please guide me

  84. Saj says:


    This is my second attempt to get this form working, with the captcha, i don’t see the captcha image..? just see a broken image, where the image needs to be showing,, there is no instruction to edit any file for the captcha part of the form, if there is then its missing in the instructions..!

    can anyone give me some help on this..?


    • Prasanth says:

      most probably, you do not have ‘GD library’ on your web server. Request your hosting service/admin to install GD library for PHP.

  85. Bear says:

    I do have GD installed on the hosting server, but no captcha image appears.
    As a starting place, I am dumping the sample files into my hosting root directory. PHP and GD are both installed. The form displays, but with out captcha image.
    A little help would be much appreciated.

  86. ESS says:

    Any way to test the code using localhost? I have it working with the confirmation page showing, but no email is sent.

    I’m using my personal email for the time being before making it live.
    Also, the scenario I’d like to use is having the submission sent to a GMail address vs. one from my domain. Possible?
    Thanks so much!

  87. jrilken says:

    I’m using the form to send an email but I’m having some trouble getting the character encoding just right. I need it to be in UTF-8 since i want Greek characters allowed…

    Thank you,

  88. RonBott says:

    Thanks very much, this works great! I do have a question on what the correct syntax would be if I wanted to pass the value of a drop down list, such as:


    Can anybody help?

  89. SATINDER says:

    Hi All,

    Can anyone help/advise me the correct step to be followed for using above mention code as
    form.html–>captcha_code_file.php ?????????????

  90. eric roo says:

    I installed this on my server and the captcha image is not displaying.

    We do have GD Library for PHP installed on the server.

    What else would make the image fail to display?

    My host provider is asking if there is a list of requirements for this somewhere…

  91. ramin says:

    Very helpful and informative post. Still a bit technical but it is not that hard to implement. Thanks again for such a useful post.

    — ramin

  92. John says:

    Like the simplicity. However, like one or two others, when I run your sample with no modification other than changing my email address the captcha works fine but doesn’t appear to be sending an email!

    Anybody offer a fix?

    • ESS says:

      Same issues here

      • ESS says:

        I found a fix (at least on my site)
        I added a sender variable:
        $your_email =’’;// <<=== update to your email address
        $sender_email ='';

        Then for the mail further down:
        $to = $your_email;
        $from = $sender_email;

        This is because cannot send mail from another domain (in my case, Gmail). But, it can send mail from itself ( to another address (

        Hope this helps

  93. John says:

    All OK…was using wrong ‘from’ domain.

  94. Nathan says:

    I get the noise image when I use this, but there’s no text in it : Any idea what’s wrong?


  95. Dan Stramer says:

    Thank you very much for the code.
    When I tested it on my server it worked fine, but when moving it to my clients server the captcha always says “wrong code” even when the letters/numbers are entered correctly.
    what could be the reason?
    This is the clients site with the captcha not working:

    Thanks in advance,

  96. Michael says:

    When I insert the form code in my blog I get script values appearing in the tex areas. Any thoughts.

  97. Daniel says:

    i try to include the captcha code in my cms(openengine). everything works fine: i see the captcha, i can refresh it…
    but the variable “$_SESSION[‘6_letters_code’] = $code;” from the file “captcha_code_file.php” is not saved in the session.

    anyone has an idea?

    thanks in advance!

  98. Bob James says:

    Thank you for this powerful script but is there a possibility to force the form to send UTF-8 content… My page is UTF-8 already but still I cant manage to let the form send with this encoding… My visitors write in Arabic and in Hebrew and everytime we get such an email on Outlook or thunderbird we keep fixing the encoding manually… I know that this is not a big deal but for a 50 years old and none technical people like my bosses it is…. Thank you

  99. ejay says:

    @Daniel, perhaps you’ve got to session_start();

  100. Paul Devine says:

    Is there a way to add another field such as telephone number?


  101. Jairo says:

    not appear the captcha code, im a begenir dunno how fix it?? can you help me??

  102. Brett says:

    I have been trying to add recaptcha to a review form offered by citricle but it does not seem to work. As a novice at this, is there a source of information I can go to in order to learn how to do this integration?

  103. Dan says:

    Anyone know how to successfully implement a drop down menu in this scenario. I can get them working but I can’t them to display on seperate lines in the email body or remember the settings should a user miss type the captcha. Any ideas?

  104. KeyDog says:

    The solution to the UTF-8 encoding issues for the emails being sent:

    $headers .= “Reply-To: $visitor_email rn”;
    $headers.=”Content-Type: text/plain;nt charset=”utf-8″n”;

  105. Boris says:

    Form isn’t working for me… I also get following codes showing in fields:


    After I click on button submit I get this error:
    Not Found
    The requested URL /< was not found on this server.
    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    What could be wrong?

  106. Sheri says:

    I installed the content form to my website, but when I test it, it just keeps asking me more anti-spam questions and doesn’t send me to the “thank you” page. Yahoo is my server, and I notice that on my original contact form after “method-post” there is another field called “action-”

    Should I add this action field to the form or is there something else keeping it from working?

    Any help at all is appreciated!

  107. Sheri says:

    Okay, I got it to work and send mail but I’m not getting a re-direct to my “thank you” page. I’m still working on the style sheet so don’t take points off for the appearance!

    Help is appreciated!

  108. Sheri says:

    I have everything working now except for the re-direct to my “thank you” page.

    Also, this code:
    <input type='text' class='spmhidip' name='GetSpamTrapInputName(); ?>’ /
    was adding a text box without a header and it wouldn’t align with the rest of the form, so I removed it. Probably shouldn’t have. What is it for. Is it essential?

  109. This forms really works, i used it on 2 of my website

  110. arubalisa says:

    Thank you so much! Found this post by searching “html email form with captcha” on google. Being self taught, this is something I have been “trying” to do for 2 years and was successful within a matter of a half hour! Easy peesey!

  111. Jeffrey says:

    I like the simplicity and how this is clean and tidy for a script, its so easy to understand, except everytime I try to get it to just display the thank you message on the same page as the form instead of a thankyou.html page it crashes, I think it would be nice to just refresh the page with the thank you message above the form just like the errors but I can’t seem to get any code to work, it just crashes, I have tried to echo but that didn’t work, something about the header(location tag has me baffled… any ideas would be great, I love this form.

  112. Hello, can this form use in my word press post

  113. Aaron says:

    Can anyone tell me the code for a drop down in this contact form. Thanks in advance.

  114. Aurélien says:

    Thank you very much for your work and the time you spent on it!
    Your form just works fine !
    Great Job!

  115. V says:

    i might be very stupid but i can’t make it work on my website :S
    i placed the script with the form on the place where it should stand.
    uploaded the php document and all the other files to the server.
    but it didn’t show the captcha.

  116. kapil says:

    Thanks for this contact forms. Really great work it helps for website designers like me.

    thanks again

  117. Beth says:

    How to you add the visitors email address to also receive a copy of the form results?

  118. saurabh says:

    really good tutorial, thanks a lot !!

  119. Prins says:

    I’ve seen the comment a few times already, but no one seems to answer or have the answer so I’ll try it again.
    The form keeps telling me that the Catcha code is incorrect.
    Even when it perfectly simular to the Captcha image.
    can anyone set this problem straight so i can get to work on the possible mail send issue!

Leave a Reply

Your email address will not be published. Required fields are marked *