Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2012
    Posts
    14
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Unhappy Can't get captcha code to validate, Help please

    Can someone please help with what I need to add to get the captcha to validate when the form is submitted.

    Code:
    <?php
    $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
    		$validationOK=true;
    		if (Trim($email)=="") $validationOK=false;
    		if (!$validationOK) {
    		  print "<meta http-equiv=\"refresh\" content=\"0;URL=/?page_id=258\">";
    		  exit;
    		}
    		$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/\">";
    		}
    		else{
    		  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.
    Last edited by IrishDoc; 10-15-2012 at 06:36 PM.

  • #2
    New Coder
    Join Date
    Oct 2012
    Posts
    14
    Thanks
    5
    Thanked 0 Times in 0 Posts
    I have managed to get the validation to work with this place before the mail to area

    Code:
    		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.';
    			exit;
    		}
    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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •