FORUMS: list search recent posts

Captcha Issue - Validates and Sends Email but Does Not Redirect

COW Forums : Web Design

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Maria MarmolCaptcha Issue - Validates and Sends Email but Does Not Redirect
by on Jun 16, 2011 at 7:52:12 pm

I had a php form that sends an email and redirects to a "thank you" page all working fine.

After adding the Google captcha code, and lots of troubleshooting, the captcha works and validates, the form sends the email as intended, but it does NOT redirect to the thank you page as it's supposed to, and as it used to.

Any help is appreciated. Thanks!!

Here's the "function" php code: (I've hidden some fields for obvious reasons)

$privatekey = "---Hidden---";
$resp = recaptcha_check_answer ($privatekey,

if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {
// Your code here to handle a successful verification

// Configuration Settings
$SendFrom = "---Hidden---";
$SendTo = "---Hidden---";
$SubjectLine = "Form Results - Testing Captcha";
$ThanksURL = "maint_thankyou.php"; //confirmation page
$Divider = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";

// Build Message Body from Web Form Input
$MsgBody = "n$Dividern";
foreach ($_POST as $Field=>$Value)
$MsgBody .= "$Field: $Valuen";
$MsgBody .= "n$Dividern"; //make content safe

if (preg_match( "/bcc:|cc:|multipart|[url|Content-Type:/i", implode($_POST))) {

// Send E-Mail and Direct Browser to Confirmation Page
mail($SendTo, $SubjectLine, $MsgBody, "From: $SendFrom");
header("Location: $ThanksURL");

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 All Rights Reserved