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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:38:18+00:00 2026-06-18T11:38:18+00:00

I have a page with two forms on, the first form is where users

  • 0

I have a page with two forms on, the first form is where users enter details such as name, address etc. (no submit button.) The second form submits the purchase details to paypal.
I am currently using the paypal form submit button with an onClick event to call a function which enters the users details into my database via $.post to a php script.

The HTML:

    <form id="regcust">
    <input type="text" name="fName" id="fName">
    <input type="text" name="lName" id="lName">
    </form>

    <form id="paypal_button_form" action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="image" src="/img/buynow.gif" onClick="registerCustomer()" name="submit">
    </form>

The jQuery:

    function registerCustomer() {
        var form = document.getElementById("regcust");
        var fn   = $("input[name='fName']").val();
        var ln   = $("input[name='lName']").val();

        $.post("RegisterCustomer.php", {  
            fName: fn, 
            lName: ln 
        });
    };

Note: I have stripped this right down for clarity.

I built the site in Chrome and everything works fine, when the user hits the paypal button, the details are recorded in my database and the user is sent to paypal to make payment. However, I just tested in Firefox and the users details are not captured, the user is sent to paypal without the details being entered? – Edit: if i put an alert() inside the function, this fires ok so it seems odd that it’s not recording the details.

I have googled and searched this site and have found similar problems/answers but none of them work on my scripts. I even installed firebug and tried through that but to be honest as a PHP guy, debugging jQuery/javascript is a bit confusing looking at all the info it is presenting to me – although the error window is always empty?

Can anyone shed any light on this for me, or point me in the right direction please as I can’t get my head around it.

Thanks in advance.

Edit: The answer posted by awl fixed my problem, thanks 😉
I did try and vote his answer but it seems my rep is too low to do so.

Can anyone shed any light as to why it worked in Chrome but not in Firefox? I’d like to try and understand what happened (or not) so I avoid situations like this again.

  • 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-06-18T11:38:19+00:00Added an answer on June 18, 2026 at 11:38 am

    It seems like there may be a race condition between the click event of the button and submitting the form. You might want to explicitly chain those events so that they always occur in the order you want. This code submits your RegisterCustomer and then only after it finishes, submits the paypal form. Wrote this off the top of my head, my not be proper:

    <form id="regcust">
    <input type="text" name="fName" id="fName">
    <input type="text" name="lName" id="lName">
    </form>
    
    <form id="paypal_button_form" action="https://www.paypal.com/cgi-bin/webscr" method="post">
    </form>
    
    <a href="javascript:;" id="buyNow"><img src="/img/buynow.gif"></a>
    

    JS:

    $(document).ready(function() {
      $("#buyNow").click(function() {
        var form = $("#paypal_button_form");
        var fn   = $("#fName").val();
        var ln   = $("#lname").val();
    
        $.post("RegisterCustomer.php", {  
            fName: fn, 
            lName: ln 
        }, function() {
             form.submit()
        });
      });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my problem: I have two forms on the same page. The first form
I have one page with two different forms on it. The first form allows
I have a JSF page with two forms (pseudo-code below). First form is for
Currently I have two pages: The first page contains an input form, and the
I have two forms, and so two different submit buttons, for one page (page
I have two forms on one page: a results form and a search form.
Let's say I have two forms. When the user finishes with the first form,
I have a web page that includes two html forms, each with a submit
I have two forms on a single page and I want to submit the
I have a simple page consisting of two forms. They cannot be displayed simultaneously

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.