View Full Version : Can't get captcha code to validate, Help please

10-15-2012, 12:56 PM
Can someone please help with what I need to add to get the captcha to validate when the form is submitted.

$to = "@gmail.com,@brilliantbulb.com";
$from = $_POST["email"];
$subject = "Quote Request";
$name = $_POST['name'];
$phone = $_POST['phone'];
$project_description = $_POST['project_description'];
$project_timeline = $_POST['project_timeline'];
$email = $_POST["email"];

// validation
if (Trim($email)=="") $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=/?page_id=258\">";
$body = "Please contact the following person to discuss their project outlined below.\n\nFrom: $name\nEmail: $email\nPhone: $phone\n\nProject Description:\n$project_description\n\nThe following is information concerning the timeline.\n$project_timeline


$success = mail($to,$subject,$body,"From: <$email>");

if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=/thank-you/\">";
print "<meta http-equiv=\"refresh\" content=\"0;URL=/?page_id=258\">";


The captcha is located at this page http://swatbeta.brilliantbulb.com/contact/request-info/ as you can see the captcha is posting correctly and refreshing as needed but it allows the form to be sent without validating the captcha text entered.

10-16-2012, 01:50 PM
I have managed to get the validation to work with this place before the mail to area

if (!empty($_SESSION['tt_pass']) && $_SESSION['tt_pass'] === $_POST['tt_pass']) {
// captcha is valid, proceed to send mail
unset($_SESSION['tt_pass']); // code valid, cannot be used more than once
} else {
// captcha code is invalid, redisplay form and show error message
echo 'The security code entered was incorrect. '
.'Please <a href="javascript:history.go(-1)">go back</a> and try again.';

But when the code is valid it is not redirecting to the thank you page in the $success area. Can someone help me with this?