PHP Captcha Error help - replace the "die" command
Posted on
16th Feb 2014 07:03 pm by
admin
Hi All,
I am after a bit of help with a Captcha spam protection box.
The site gave me instructions, and all is well, apart from if the user give the wrong Captcha information...
The highlighted code is the part where i would like help, i would like the error message to appear in the same area/under submit button, in the form. For example: "*Wrong input for Captcha ", not take the user to a new screen, and make them hit the back button.
ANY help would be greatly appreciated, as im very new to PHP and not really sure whats what.
The code is:
***** PLEASE THE CODE TAG WHEN POSTING SOURCE CODE *****Line number On/Off | Expand/Contract<?phprequire_once('recaptchalib.php');$privatekey = "************************";$resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); [color=#0000FF]if (!$resp->is_valid) { die ("The reCAPTCHA wasn't entered correctly. Please go BACK and try again..." . "(reCAPTCHA said: " . $resp->error . ")");}[/color] $to = "grant@********";$subject = "Enquiry";$name = $_REQUEST['name'] ;$phone = $_REQUEST['phone'] ;$email = $_REQUEST['email'] ;$message = $_REQUEST['message'] ;$headers = "From: $email";$body = "Enquiry From: $name.nn$name's Phone Number: $phone.nnEnquiry:n$message";$sent = mail($to, $subject, $body, $headers) ;if($sent){header( 'Location:******** TEST_ENVIRONMENT/Tatar/thank_you.php' ) ;}else{print "We encountered an error sending your enquiry"; }?>
Thank you in advance
No comments posted yet
Your Answer:
Login to answer
233
45
Other forums
word wrap in emails help needed
Hello, I understand how wordwrap works in php and have used it well before. However when I used wor
have trouble in a if condition
The if below is working ok, it check when indexes, name, zipcode and state are empty.
Code: &
Need help making login verification cleaner...
I use the below to verify user login. I first check the cookie for the id, ip and a unique id. If it
Calander Basic Spript help
hi, just starting out with PHP and have the following script:
<?php
//This gets t
Can't seem to capture a variable in a chained select
I'm *this* close to having a chained select running but for some reason it doesn't seem to be pickin
echo $rows help
Hi all,
Hopefully something simple that I don't know!
I have this:
Code: [Selec
simplexml and xpath - Need some help
Hello,
I am trying to parse an xml which comes back from Amazon and I am trying to know how m
Accessing element of object array
Hello
My object looks like this:
Array ( [0] => User Object ( [id] =>
login from external site
Hi my new experience begins, Now what i am trying to do is i make three pages, login.php logout.php
returning data from an ssh2_exec()
here's what i got.
$conn = ssh2_connect($this->_host);
ssh2_auth_password($c