Jump to content

pixelchicken

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

pixelchicken's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi all, I have found a thread that relates to my query but I'm a novice so it doesn't make any sense.. Basically, I have just implemented captcha on my site (php code below) and it's all working yey! All I need to do, is to alert the user if they enter an incorrect code, and *stay on the same page*. I have the alert working fine in Javascript, but it then takes the user to a blank page. I want to alert them (*you've entered a wrong code*) and then stay on the same page. Simple enough right? Any ideas grately appriciated! Code: <?php require_once('captcha/recaptchalib.php'); $privatekey = "6Lcil78SAAAAALYbGUXf2ophiajdWJuPho7A63La"; $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 ?> <script language="javascript"> alert("Verification words do not match image. Please try again."); </script> <? // **** NEED CODE HERE TO STAY ON SAME PAGE **** header( "Location: contact.php" ); } else { // Code here to handle a successful verification $to = "[email protected]"; $subject = "Contact / Booking Form from the Trevalia Website"; $name = $_REQUEST['name']; $email_field = $_POST['email']; $phone = $_POST['phone']; $comments = $_POST['comments']; *******"; $body = "From: $name \n\n E-Mail: $email_field\n\n Phone Number: $phone\n\n Message:\n $comments"; header( "Location: thankyou_contact.html" ); mail($to, $subject, $body, $headers); } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.