Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6913491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:13:33+00:00 2026-05-27T09:13:33+00:00

I came across the problem, I’m using reCAPTCHA to protect against spam bots. The

  • 0

I came across the problem, I’m using reCAPTCHA to protect against spam bots. The problem is that when user enters wrong characters or leaves captcha blank, it echoes an error message.
it also refreshes the page and all information that was entered by a user is lost.
My question is, how to show reCAPTCHA error message without page refresh? e.g. an alert box or even better a hidden error div that displays if wrong captcha was entered.

HTML

<form action="" method="post" enctype="multipart/form-data">
   <div id="sc_header" style="margin-top: 11px;">Human check</div>
      <p><?php
          require_once('recaptchalib.php');
          $publickey = "my_public_key_here";
          echo recaptcha_get_html($publickey);
          ?></p>
       <p style="float: left;"><input type="submit" value="Send"></p>
       <input name="story-create" type="hidden" value="submit">
</form>

PHP

<?php
if ($_POST['story-create'] == "submit"){
      require_once('inc/recaptchalib.php');
      $privatekey = "my_private_key_here";
      $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 {

      }
  }
  ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:13:33+00:00Added an answer on May 27, 2026 at 9:13 am

    A simple way of retaining the user input is to have the form submit to the same script that produced the form. An outline of this approach could be:

    signup.php

    <?php
    
    // if data submitted, perform validation (if sign up is successful, redirect to success page)
    
    ?>
    <form action="signup.php" method="post">
        <input type="text" name="username" value="<?php if (!empty($_POST['username'])) echo strip_tags($_POST['username']) ?>" />
        <!-- etc... -->
    </form>
    

    This answers assumes you want “without page refresh” because you think it will avoid clearing of the form, rather than wanting an AJAXian solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently I came across a problem that asks to find out the non-unique characters
I came across a problem in my current application that required fiddling with the
Today I came across a problem where someone had accidentally committed a proj.user file
I just came across with a problem using XmlDocument.LoadXml . The application was crashing,
I came across a problem that seems to be called drowning in autorelease pools.
I came across a problem while updating a typed DataTable that has a primary
I delved into C# but came across a problem that I seem unable to
Possible Duplicate: Learning efficient algorithms I recently came across an problem that was solved
I came across a problem using jQuery to retrieve an RSS feed located on
I was experimenting with some examples and came across a problem that if we

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.