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

  • Home
  • SEARCH
  • 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 7053619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:31:38+00:00 2026-05-28T03:31:38+00:00

I have a DropDown menu in an HTML form each with a specific value

  • 0

I have a DropDown menu in an HTML form each with a specific value with them, What I need to do is add each of the values of the dropdown menus that the user selects and echo that total back to them, how do I do that?

For example I have this form

    <select name="value1" id="jumpMenu" onchange="this.form.submit();" action="table.php">
    <option value="1" selected="selected">Shoe</option>
    <option value="2">Sock</option>
    </select>

    <select name="value2" id="jumpMenu" onchange="this.form.submit();">
    <option value="1" selected="selected">Red</option>
    <option value="2">Green</option>
    </select>

If a user selects say “Sock” and “Green” I need a script to add the two values together to equal 4 and echo that number to the user.

  • 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-28T03:31:38+00:00Added an answer on May 28, 2026 at 3:31 am

    You can use javascript to get each select element. Then find the selected option and parse out its value. Finally add the sums.

    http://jsfiddle.net/d9ntv/

    javascript only solution

    <script>
        function alertTotal() {
            var aSelect = document.getElementById('a');
            var bSelect = document.getElementById('b');
            var cSelect = document.getElementById('c');
            var aValue = aSelect.options[aSelect.selectedIndex].value;
            var bValue = bSelect.options[bSelect.selectedIndex].value;
            var cValue = cSelect.options[cSelect.selectedIndex].value;
    
            alert(parseInt(aValue) + parseInt(bValue) + parseInt(cValue));
        }
    </script>
    <button onclick="alertTotal();">Show Total</button>
    <select id="a">
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>    
    </select>
    <select id="b">
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>    
    </select>
    <select id="c">
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>    
    </select>
    

    jQuery solution. jQuery makes using javascript a lot easier. Although I would caution you to make sure you understand javascript before progressing to jQuery.

    http://jsfiddle.net/d9ntv/2/

    $('button').click( function() {
        var total = 0;
        $('select').each( function() {
            total += parseInt($(this).val());
        });
        alert('jQuery: ' + total);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a css dropdown menu with an HTML select form inside of that
I have a dropdown menu that is filled by a mysql database. I need
I have the following html in my ASP.NET form. It represents a dropdown menu
I have a dropdown menu with a couple of values that link to functions.
I have a range of items in an HTML drop-down menu that I need
i have a HTML form, user should be able to add other text boxes
I have dropdown menu..which is dynamic.. How can get value of the last item
I have a form that submits parameters using standard HTML controls to a PHP
I have a simple form that has a list (dropdown list generated from a
I have a little dropdown menu similar <select> , which contolled from external js-function.

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.