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 6219447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:46:57+00:00 2026-05-24T07:46:57+00:00

is possible to use php to reset a form without refresh? how can i

  • 0

is possible to use php to reset a form without refresh?
how can i archive this?

or is possible to do it with js?

most important is do it without to refresh the page and dont add another button for this(that’s because the design)

any idea?
thanks
am working with recaptcha on my form and once i submitted the information i want to send a message
this is my js code

function validateCaptcha(){
    challengeField = $("input#recaptcha_challenge_field").val();
    responseField = $("input#recaptcha_response_field").val();
    nameField = $("input#name").val();
    emailField = $("input#email").val();
    phoneField =$("input#phone").val();
    reasonField =$("select#reason").val();
    messageField =$("textarea#message").val();
    var html = $.ajax({
    type: "POST",
    url: "ajax.recaptcha.php",
    data: "recaptcha_challenge_field=" + challengeField + "&recaptcha_response_field=" + responseField +"&name="+ nameField +"&email=" + emailField +"&phone="+ phoneField + "&reason=" + reasonField +"&message=" + messageField,
    async: false
    }).responseText;

    if(html == "success")
    {
        $("#captchaStatus").html("Success. Submitting form.");
        $("#thanks").html("Thank you, we going to keep in touch with you soon.  ");
        return false;

    }


    else
    {
        $("#captchaStatus").html("Your captcha is incorrect. Please try again");
        Recaptcha.reload();
        return false;
    }
}

this is my php code

    $name = $_POST['name'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];
    $reason = $_POST['reason'];
    $message = $_POST['message'] ;

    if (empty($name)|| empty($email) || empty($message))
    {

    }
    else
    {
        $resp = recaptcha_check_answer (PRIVATEKEY, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
        if ($resp->is_valid) {

            $header = 'From: ' . $email . " \r\n";
            $msg = "Sent from: " . $name . "\r\n";
            $msg .= "Email: " . $email . " \r\n";
            $msg .= "Phone: " . $phone . " \r\n";
            $msg .= "Contact reason:" . $reason . " \r\n";
            $msg .= "Message: " . $message . " \r\n";

            $to = 'patricia@anetdesign.com';
            $subject = 'Emailmakers contact page';

            mail($to, $subject, utf8_decode($msg), $header);

             ?>success<?


        }
        else 
        {
        die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
           "(reCAPTCHA said: " . $resp->error . ")");

}
}
  • 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-24T07:46:58+00:00Added an answer on May 24, 2026 at 7:46 am

    Well, once you sed the ajax request if the captcha fails then just reload the entire form.

    Say you have only the form in myform.php and you include it in your main page, when the captcha does not match you can just reload the form. Like this:

    if (html != "Success")
    {
         $("#divThatHoldsTheForm").html(html)
    }
    

    and in your myform.php you have only:

    <form action="..." method="POST">
      <!-- some inputs -->
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.