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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:13:49+00:00 2026-06-08T14:13:49+00:00

I’m trying to create an HTML form that will add up the prices of

  • 0

I’m trying to create an HTML form that will add up the prices of various options selected for a product, and then POST to PayPal’s Buy Now function.

Here’s an example of the PayPal buy now form. I’m trying to add the functionality to allow each variation to add up to a final amount before post. Why PayPal doesn’t allow this to begin with is beyond me. No time for a rant though.

Here is paypals example of a Buy Now form with pricing. The issue is that you can only select final price. It doesn’t allow for matrix style pricing.

eg:
Item Price: $50

Variation 1:
— Option A: +$25
— Option B: +$50

Variation 2:
— Option A: +$10
— Option B: +$15

So if you select 1A and 2B the form posts $50 + $25 + $15 = $90

<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> 

<!-- Identify your business so that you can collect the payments. --> 
<input type="hidden" name="business" value="herschelgomez@xyzzyu.com"> 

<!-- Specify a Buy Now button. --> 
<input type="hidden" name="cmd" value="_xclick"> 

<!-- Specify details about the item that buyers will purchase. --> 
<input type="hidden" name="item_name" value="Hot Sauce"> 
<input type="hidden" name="currency_code" value="USD"> 

<!-- Provide a dropdown menu option field. --> 
<input type="hidden" name="on0" value="Type">Type of sauce <br /> 
    <select name="os0">  
        <option value="Select a type">-- Select a type --</option> 
        <option value="Red">Red sauce</option> 
        <option value="Green">Green sauce</option> 
    </select> <br /> 

<!-- Provide a dropdown menu option field with prices. --> 
<input type="hidden" name="on1" value="Size">Size <br /> 
    <select name="os1"> 
        <option value="06oz">6 oz. bottle - $5.95 USD</option> 
        <option value="12oz">12 oz. bottle - $9.95 USD</option> 
         <option value="36oz">3 12 oz. bottles - $19.95 USD</option> 
    </select> <br /> 

<!-- Specify the price that PayPal uses for each option. -->  
<input type="hidden" name="option_index" value="1"> 
<input type="hidden" name="option_select0" value="06oz"> 
<input type="hidden" name="option_amount0" value="5.95"> 
<input type="hidden" name="option_select1" value="12oz"> 
<input type="hidden" name="option_amount1" value="9.95"> 
<input type="hidden" name="option_select2" value="36oz"> 
<input type="hidden" name="option_amount2" value="19.95"> 

<!-- Display the payment button. --> 
<input type="image" name="submit" border="0" 
    src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" 
    alt="PayPal - The safer, easier way to pay online"> 
<img alt="" border="0" width="1" height="1" 
    src="https://www.paypal.com/en_US/i/scr/pixel.gif" > 
</form>
  • 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-08T14:13:55+00:00Added an answer on June 8, 2026 at 2:13 pm

    Add the following script at your page head or before the form.

    <script>
                selects = array(0,0);
                function recordSelect(i){
                    ++selects[i];
        if (selects[i] > 1) selects[i] = 1;
                    if (selects[0] == 1 && selects[1] == 1 ) document.getElementById('#YourformId').submit();
                }
            </script>
    

    This solution assume that you have set id attribute value to your form.
    Then in every select in your form add onChange event with recordSelect() as follows:

    <select name="os0" onchange="recordSelect(0)">  
        <option value="Select a type">-- Select a type --</option> 
        <option value="Red">Red sauce</option> 
        <option value="Green">Green sauce</option> 
    </select> 
    
    <select name="os1" onchange="recordSelect(1)">  
            <option value="Select a type">-- Select a type --</option> 
            <option value="another">something</option> 
            <option value="another2">item</option> 
        </select> 
    

    Please Notice the passed argument of recordSelect

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

Sidebar

Related Questions

I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I need a function that will clean a strings' special characters. I do NOT
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.