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
45
Other forums
using explode() to fill in checkboxes
Hi
I have a field stored in a table that contains regions in the UK separated by commas. Ther
Which PHP-Editor do you think is the best?
Hi everyone,
Myself Brian Anderson. For the last 2 years i have been working a
ALV List display - header width adjust
Hi,
I am using REUSE_ALV_LIST_DISPLAY for my ALV display.The width of the ALV varies for
Regular expression tips or resources
Hello! I'm having some issues implementing the appropriate regex patter to eliminate unwanted charac
Code working in IE but not FireFox
I created a dynamic navigation list for my website based off of a table in my database. The code is
progress bar...need expert opinion of experienced webmaster
Hey guys, quick question:
I want to display a progress bar when I upload files, but I am not
New Search Engine
Hey everyone,
I have a ZIP Code Radius search engine already functional. it displays all of t
onClick='location.href=index.htm'> not working
Below is my code:
echo "<input type='button' value='redirect' onClick='location.h
Select all entries from database that include a phrase
I have a database of clubs - one of the categories is meeting time and place
I would like to have
mysql VARCHAR acting like INT
Hi, All.
I have a table that contains a varchar(10) column named weird_field. In this column