Recaptcha Error On Same Page
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Recaptcha alert incorrect on same page up vote 0 down vote favorite I have the code
on the main page with the action being require_once('recaptchalib.php'); $privatekey = "6LeSzekSAAAAAAdAxcsVugyScb8B1D6UoKpjrX2W"; $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 die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } else { $comment = $_POST['comment']; $to = "jsmith@example.com"; $subject = $_POST['sub']; $message = $comment; $from = "jsmith@example.net"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; header( 'Location: success.html' ) ; } When a user INCORRECTLY enters reCAPTCHA code the page is moved onto a blank page saying recaptcha was not entered correctly. I want to ask, how can I implement either an javascript alert or red text that appears on the main page so users will not have to press the back button all the time. Thanks javascript php recaptcha share|improve this questionhere for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up reCaptcha show error same page up vote 0 down vote favorite How can http://stackoverflow.com/questions/19829452/recaptcha-alert-incorrect-on-same-page i show error in same page? my form page
teklif.php if (!$resp->is_valid) { // What happens when the CAPTCHA was entered incorrectly die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } http://stackoverflow.com/questions/10470245/recaptcha-show-error-same-page Above die show up teklif.php and it's look weird. I want the die message show up in form page i mean same page. Is there any solution? (Sorry for my English.) php recaptcha share|improve this question asked May 6 '12 at 11:45 mrchad 1791415 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote place the php code on top of your page and leave the action attribute of form element blank. for example is_valid) { // What happens when the CAPTCHA was entered incorrectly die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } } ?> I assume you have an input="submit" with the name attribute set as 'submit'. now place this code below. share|improve this answer answered May 6 '12 at 11:51 Ibrahim Azhar Armar 11.1k2169138 It's not work. I guess it is not for wordpress. –mrchad May 6 '12 at 12:03 well Wordpress is PHP. so it should work, my guess is the problem lies with the name attribute of inpNew? Today's Posts FAQ Rules Guidelines Search Advanced Search Forum :: Server side development PHP Display ReCaptcha error on same page as form If this is your http://www.codingforums.com/php/255823-display-recaptcha-error-same-page-form.html first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To http://wordpress.stackexchange.com/questions/7791/how-to-display-comment-form-error-messages-in-the-same-page start viewing messages, select the forum that you want to visit from the selection below. Enjoy an ad free experience by logging in. Not a member yet? Register. Results 1 to 3 recaptcha error of 3 Thread: Display ReCaptcha error on same page as form Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Rate This Thread Current Rating Excellent Good Average Bad Terrible 04-01-2012,11:14 PM #1 24seven View Profile View Forum Posts Regular Coder Join Date Dec 2009 Posts 155 Thanks 34 Thanked 1 Time in 1 Post Display ReCaptcha error on same page recaptcha error on as form So I've got this form that works great. It submits to itself with recaptcha, validation.. everything works great. Now all the sudden, I need to change one of my forms. The problem is when a customer adds an item from Paypal, they click return to shopping cart and it takes them back to the beginning of the form. I've been told to try sesssions but it doesn't seem to matter how I have them it still starts them at the beginning of form.php because like I said, it submits to itself. To resolve this I made form_results.php for it to go to instead and on this page I have the cart and without it having ties to the form, the user can click return to cart and everything is dandy.. The problem I'm having is either: 1. I can't seem to get sesssions to work right and therefore need to do it this 2 page way. If someone can show me where i'm going wrong in my session parts, that is one solution. 2. Using it this other I'm not sure how to submit to a seco
tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us WordPress Development Questions Tags Users Badges Unanswered Ask Question _ WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top How to display comment form error messages in the same page up vote 2 down vote favorite I want to display comment form validation errors (as well as captcha error) on the comment form itself and not on a different page. How can I do that? comments comment-form share|improve this question edited Oct 14 '14 at 20:09 mrwweb 6,54411855 asked Jan 26 '11 at 7:59 hannit cohen 88131527 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote accepted This question have answered again, here Also you can do the same with JQuery and Validation plugin share|improve this answer edited Oct 14 '14 at 19:46 Pieter Goosen 37.2k113687 answered Jan 26 '11 at 8:04 Philip 1,42611525 Used the jquery with some extra configuration and captcha adjustments –hannit cohen Jan 27 '11 at 2:40 add a comment| up vote 2 down vote I was facing same problem and was searching for solution i found the solution Open your function.php file and past below code: function comment_validation_init() { if(is_single() && comments_open() ) { ?>