troubleshooting Question


Avatar of goski
goski asked on
10 Comments1 Solution658 ViewsLast Modified:
I am trying to implement the CAPTCHA script found at:

I have the security code displaying but do not know were to put the code that compares the code entered against the code display.

I am having a little problem figuring out were to put the following code:
   if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
      // Insert you code for processing the form here, e.g emailing the submission, entering it into a database.
   } else {
      // Insert your code for showing an error message here
My HTML code looks like this:
<form method="POST"  onsubmit="return validatecontactus(document.Contact_Us);" language="JavaScript" name="Contact_Us" action="">
              <p class="class3"><BR>
                Tell us what you think about our web site, our products, our organization,
                or anything else that comes to mind. &nbsp We welcome all of your comments and suggestions.
                <input type="hidden" Name="recipient" value="" enctype="TEXT/PRE">
                <input type="hidden" Name="subject" value="Dana's Apparel Inquiry">
                <input type="hidden" name="redirect" value="">
                <input type="hidden" Name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT">
I use JavaScript to validate the required fields on the form.  It looks like this.
function validatecontactus(contact)
 var fieldtofocus = ""
 var alert_text = ""
 if(contact.comments.value == "")
 alert_text += "Please enter your comments in the Text area.\n";
 if(fieldtofocus == "") {eval("contact.comments.focus();");fieldtofocus = "filled";}
 if(contact.fullname.value == "")
 alert_text += "Please enter your full name.\n";
 if(fieldtofocus == "") {eval(";");fieldtofocus = "filled";}
 if( == "")
 alert_text += "An email is required.\n";
 if(fieldtofocus == "") {eval(";");fieldtofocus = "filled";}
 if(fieldtofocus == "filled")
 alert("Required Fields:\n" + alert_text);
 return false;
 return true;
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros