Author Topic: Inserting CAPTCHA into existing form....  (Read 637 times)

Bruce1969

  • New Member
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Inserting CAPTCHA into existing form....
« on: September 09, 2010, 08:40:39 AM »
I have an existing form (see link below) and would like to implement a CAPTCHA, but I don't want to reconfigure my scripts - I just want to be able to have my SUBMIT verify the code (as I have existing alerts if a user doesn't complete all fields):
 
http://www.prescriptionpc.com/#section=contact
 
The FORM code this is using is the following:
<form id="ajax-contact-form" method="POST" action="javascript:alert('success!');">
The above form "calls" a separate php file to validate and process the form.
 
So.....
if anyone knows a way or method of incorporating just the CAPTCHA code for validation within this exisitng form, please let me know.
 
Any and all help is greatly appreciated!
-Bruce

Bruce1969

  • New Member
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Inserting CAPTCHA into existing form....
« Reply #1 on: September 17, 2010, 01:18:19 PM »
I figured it out....

All I did was insert my CAPTCHA "alert" code (see below) into my existing validation form:
====================================
if(isset($_POST["captcha"]))
if($_SESSION["captcha"]==$_POST["captcha"])
{
    //CAPTHCA is valid; proceed the message: save to database, send by e-mail ...
   echo 'Security Code Incorrect!';
}
====================================

Then all I did was add method="post" to my <form>