Captcha Wont Display Error

Giarc86

Expert Member
Joined
May 28, 2008
Messages
1,243
Reaction score
4
I put Captcha on a form of mine, but instead of redirecting it to another page I put the form submission on the same page. It submits the data no problem. However it doesn't display the "Incorrect" message when it isn't entered correctly. It doesn't allow the form to be submitted though, but I can't think were the incorrect message is supposed to go.

Been struggling with this the morning, sure it's something simple.
If someone could help would be appreciated.

Thanks

PHP:
<form action="new.php" method="post">

<?php
$publickey = "mykey";
$privatekey = "mykey";

include('recaptchalib.php');


$resp = null;

$error = null;

if ($_POST["recaptcha_response_field"]) {
        $resp = recaptcha_check_answer ($privatekey,
                                        $_SERVER["REMOTE_ADDR"],
                                        $_POST["recaptcha_challenge_field"],
                                       $_POST["recaptcha_response_field"]);

        if ($resp->is_valid) {
                echo "Submitted Successfully";

if ($_POST["email"]<>'') { 
	$ToEmail = '[email protected]'; 
	$EmailSubject = 'Somebody Please Contact Me Form '; 
	$mailheader = "From: ".$_POST["email"]."\r\n"; 
	$mailheader .= "Reply-To: ".$_POST["email"]."\r\n"; 
	$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; 
	$MESSAGE_BODY = "Name and Surname: ".$_POST["namesurname"]."<br>"; 
	$MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>";
	$MESSAGE_BODY .= "Cell Phone Number: ".$_POST["cell"]."<br>";
	$MESSAGE_BODY .= "Other Comments: ".nl2br($_POST["comment"])."<br>"; 
	mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); 
        } else {
           	$error = $resp->error; 
        }
}
?>
<?php 
} else {
	
?>
 
Have a look at my contact form I am busy with at the moment for a client. Play around with it insofar as validation on the input fields (put garbage in to see what happens) and test the captcha control.
The temp site is http://readyauto.computerguy-za.com/contact.php Its still a work in progress.


If that's what you are looking for, complete the form with your details and I will email you the pieces of code I found in cyberspace which I combined to get the desired affect.
 
Last edited:
I get this error message when I email you

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:


SMTP error from remote mail server after end of data:
host gmail-smtp-in.l.google.com [72.14.213.27]:
552-5.7.0 Our system detected an illegal attachment on your message. Please
552-5.7.0 visit http://mail.google.com/support/bin/answer.py?answer=6590 to
552 5.7.0 review our attachment guidelines. k21si6400047yba.20

------ This is a copy of the message, including all the headers. ------
------ The body of the message is 1886496 characters long; only the first
------ 106496 or so are included here.
 
I did get it via email though, will help me a lot.

Thanks very much.
 
Top
Sign up to the MyBroadband newsletter
X