hi,
how can i submit two forms with one button, one to send the order to me and the other to paypal? I need it to not contain javascript. I have this one so far but when customers have js disabled i get the payment but not the order contents.

onSubmit="document.forms['form_2'].submit();"

    Have the script handling the form that was sent to you make the second form submission to paypal.

    Not only does this not break the operating principles of http, but also means that you can control the contents of the form sent to paypal.

      here's one i just did below

      <form action="some_page.php" method="POST" target="_blank" name="form1">
      
      </form>
      <form action="some_page.html" method="GET" target="_blank" name="form2">
      
      </form>
      <script language="javascript">
      function submitForms(){
      document.form1.submit();
      document.form1.submit();
      }
      </script>
      <a href="#submit" onClick="submitForms();" id="submit">Submit</a>
      [code]
        bradmasterx wrote:

        here's one i just did below

        Nice; now factor in the requirement that it work without Javascript 😉

          Thanks for your effort, this seems to be not as rare as it looks. I have searched google for hours trying to find a compliant solution. At the moment i have just some no script tags with a message in to enable active scripting. From my view the type of customers i deal with mostly find it challenging to add an item to their cart let alone change browser settings. 🙂

          The paypal form is..

                          <form action="https://www.paypal.com/cgi-bin/webscr" method="post" style="display:inline" onSubmit="document.forms['form_2'].submit();">
                            <input type="hidden" name="cmd" value="_xclick" />
                            <input name="return" type="hidden" id="return" value="/cart/ordercompleted.php" />
                            <input type="hidden" name="business" value="sales@x.co.uk" />
                            <input type="hidden" name="item_name" value="Order #<?php echo $orderid; ?> " />
                            <input type="hidden" name="amount" value="<?php echo $total_price; ?>" />
                            <input type="hidden" name="currency_code" value="GBP" />
          	  <input type="hidden" name="shipping" value="0.00">
          	  <input type="hidden" name="no_shipping" value="2">
                            <input type="image" name="submit" src="/images/checkout.png" alt="Pay Now" />
                          </form>
          

            Have the script handling the form that was sent to you make the second form submission to paypal.

            Not only does this not break the operating principles of http, but also means that you can control the contents of the form sent to paypal.

              How can i send one form to two places, is this what you were suggesting weedpacket?

                I believe what he is suggesting is to send the form to one PHP script, then use that PHP script to send the necessary form data to the external site via the [man]cURL[/man] functions or similar methods. That script can also parse the data returned by the external site's response to that form submission allowing you to do whatever needs to be done at that point to continue processing the request.

                  2 months later

                  Hey all....

                  I have a similar need, but actually very different.

                  I am preparing an online registration for our local Chamber of commerce. It requires some maneuvering to get the results we want.

                  The initial form captures registration info (name, address, etc).

                  When completed, I would like it to give the user two payment choices:

                  1. Pay by check or money order.

                  2. Pay by PayPal

                  If the user chooses "Check or Money Order", the form immediately submits and user goes to "Thank You" page.

                  If the user chooses "PayPal", the info part of the form is submitted, and the user is redirected to a PayPal payment page.

                  Is this possible?

                  Thanks in advance!!

                  🙂

                    Write a Reply...