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.

Did you know?Explore Trending and Topic pages for more stories like this.
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 Like 45 Dislike
Previous forums Next forums
Other forums

JSON SORT WITH PHP
I have two products that I want to sort by say "Id:17, value: xxx" using php
The page w

A little help needed passing hidden values to next page
I have a page that has hidden values in a form.

example
Code: <input name='signupID

Need help in log in and log out?
hi there all of u. i have recently created a site for someone. i have placed log in and log out and

Echoing a Variable from a Object
How do I get a variable from the new User Class to echo out in this clasS?

class MyApp
{

PHP not creating file.
Its supposed to create a .ini file in the /scriptfiles/users/ with the name they entered into the fi

DirectoryIterator and Hacked Website
Hi Everyone.

My problem:
Some one has been sneaking in to my website hidden Iframes. I've

IF Statement & Two Tables With Different Echoes
I'm retrieving two tables in a single query using UNION ALL, like so:

Code: $query = "SE

present value of sequence?
Hi

Please help me to find out the present value of sequence?

Thanks

help with mysql_error()
Hi,

I am trying to insert data into a table, but I am not able to insert it. I wanted to see

Image loading
Hi Developers,

I'm trying to display an image from images/image.gif getting the url from mysq

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash