austin350s10 Posted May 27, 2009 Share Posted May 27, 2009 I am trying to use reCAPTCHA but I am running into some problems. The code below is my mail handler program. <?php require_once('recaptchalib.php'); $privatekey = "....."; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if(!$resp->is_valid) { header("location:captcha_error.html"); die(); } ?> <?php /*subject and email variables*/ $emailSubject = 'OptOut'; $webMaster = '[email protected]'; /*gathering data variables*/ $emailField = $_POST['email']; /*email field*/ $body = <<<EOD <br><hr><br> <h2>Please remove this email address from our mailing list</h2> <hr> $email <br> EOD; /*email sender script*/ $headers = "From: Website\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /*resultes*/ $theResults = <<<EOD <html> <body> Thank you </body> </html> EOD; echo "$theResults"; ?> The problem I am having is that when the user enters a wrong security code they are directed to a separate error page: captcha_error.html. The error page has a link on it that directs the user back to the form but when they go back to the form all the questions the user entered end up disappearing. Is there a way I can make the error message appear on the same page as the form itself? Or a way the form can hold its values? You can test the my web page http://www.affordablehomecare.org/functions/example-captcha.php Thanks, -Austin- Link to comment https://forums.phpfreaks.com/topic/159922-recaptcha-problems/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.