zero-perfoliate
zero-perfoliate

Author Topic: How to exit to a web page upon providing successful 'Recaptcha' input  (Read 709 times)

LindaJimerson

  • Guest
Hello - Thanks for any help you can provide.  Below is code I am using for "recaptcha" form validation.  It works well EXCEPT that (instead of echoing 'You got it!') as shown below when the accurate words are entered, I want to exit to another web page.    What is the php code that would replace echo "You got it!";  and instead exit to another web page?  Thanks very much.   linda jimerson
 

<form action="" method="post" >
 <?php
 
require_once('recaptchalib.php');
$publickey = "6Le-0AEAAAAAAGV3Ln-w867BhcXcme3hvBBpyQy7";
$privatekey = "6Le-0AEAAAAAAEYvsU9tKhDCaLC3wKhqaCDSvjQ_";
$resp = null;
$error = null;
if ($_POST["submit"]) {
  $resp = recaptcha_check_answer ($privatekey,
          $_SERVER["REMOTE_ADDR"],
           $_POST["recaptcha_challenge_field"],
          $_POST["recaptcha_response_field"]);
  if ($resp->is_valid) {
 
    echo "You got it! ";
   
  } else {
   
    $error = $resp->error;
  }
}
echo recaptcha_get_html($publickey, $error);
?&g t;
   
 

    <input type="submit" name="submit" value="submit" />
    </form>
 ???

icestormz

  • Guest
give this a shot remember to change the mypage.html to the one you want

<form action="" method="post" >
 <?php
 
require_once('recaptchalib.php');
$publickey = "6Le-0AEAAAAAAGV3Ln-w867BhcXcme3hvBBpyQy7";
$privatekey = "6Le-0AEAAAAAAEYvsU9tKhDCaLC3wKhqaCDSvjQ_";
$resp = null;
$error = null;
if ($_POST["submit"]) {
  $resp = recaptcha_check_answer ($privatekey,
          $_SERVER["REMOTE_ADDR"],
           $_POST["recaptcha_challenge_field"],
          $_POST["recaptcha_response_field"]);
  if ($resp->is_valid) {
 
    header("Location: mypage.html");
   
  } else {
   
    $error = $resp->error;
  }
}
echo recaptcha_get_html($publickey, $error);
}
   ?>
 

    <input type="submit" name="submit" value="submit" />
    </form>

 

zero-perfoliate