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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:08:39+00:00 2026-06-06T18:08:39+00:00

<Select id=amount onchange=document.formName.submit(); updateCost();> <option id=0 value = 0> Select amount … </option> <option

  • 0
<Select id="amount" onchange="document.formName.submit(); updateCost();">
   <option id="0" value = "0"> Select amount ... </option>
   <option id="1" value = "2000"> $2000 </option>
   <option id="2" value = "3000"> $3000 </option>
   <option id="3" value = "4000"> $4000 </option>
   <option id="4" value = "5000"> $5000 </option>
</Select>

<Select id="duration" onchange="document.formName.submit(); updateCost();">
   <option id="1" value="2 years"> 2 years </option>
   <option id="2" value="6 years"> 6 years </option>
   <option id="3" value="Lifetime"> Lifetime </option>
</Select>

function updateCost() {      
  var rate = 0;
  if(document.formName.plan[p].checked) {
    if(value('coverageUser').indexOf('Enrolled') > -1){
       rate = getRate();    
    }
    payCycle = 1;
    document.formName.cost.value = formatCurr((rate) * payCycle);
  }    
}

I have these two select boxes and when I choose an option from first, cost is getting updated correctly. But after selecting amount, I am supposed to select duration from second selectbox where default value is 2 years. But when I change the value to 6 years, cost is updated , but the select box option does not remain to 6 years, but changes back to 2 years. How do I keep the option I selected in second select box and also update the cost correctly?

  • 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-06T18:08:40+00:00Added an answer on June 6, 2026 at 6:08 pm

    The select boxes don’t keep their state because of the submit you’re doing at onchange().
    It will cause page reload on every change. Try remove it from both select‘s.

    Besides that, you’re using id in a wrong way: you can’t have the same id twice in a same page. Try something like this:

        <option value="1"> 2 years </option>
        <option value="2"> 6 years </option>
        <option value="3"> Lifetime </option>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

$data = $mysqli->prepare(SELECT amount FROM items WHERE id=:id); echo 'forward1'; if(!$data->execute(array(':id' => $id))) die(error
Why does this return 23 rows (the right amount): select users.user_id, users.fname, users.lname, stars.stars,
I have a query like this: SELECT COUNT(*) AS amount FROM daily_individual_tracking WHERE sales
I want to create the following T-SQL statement: SELECT SUM (sa.Amount) as 'SumAmount', SUM(sa.Cost)
I'm new to MySQL, and I'm running this query, SELECT item_id,amount FROM db.invoice_line WHERE
I have a MySQL query like this: SELECT DAYNAME(CreatedAt) AS TheDay, SUM(Amount) AS TheSum
I was under the impression this is valid SQLite syntax: SELECT *, (SELECT amount
If SELECT SUM(amount) FROM transactions ORDER BY order LIMIT 0, 50 sums the amount
My SQL query: select *, (select sum(Amount) as TotalAmount from Payment where Customer.Id =
SELECT table_1.id, (SELECT SUM(amount) FROM table_2 WHERE table_1.id = table_2.bid) AS sum_total FROM table_1

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.