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 Marmol
Captcha Issue - Validates and Sends Email but Does Not Redirect
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)

<?php
require_once('recaptchalib.php');
$privatekey = "---Hidden---";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);

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))) {
$spam=true;
}

// 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 CreativeCOW.net All Rights Reserved
[TOP]