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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:10:32+00:00 2026-05-14T19:10:32+00:00

I have a page that allows a user to choose some things in a

  • 0

I have a page that allows a user to choose some things in a form and it will calculate the weight using javascript. It breaks it up into 5 variables that I need to send to another page. Originally I was just having it put the variable into a text box and then I was posting that text box. However I dont want to have 5 text boxes. So now I need to somehow send or post the five variables to another page. Here is my javascript function. I need to post weightBoxOne – weightBoxFive

js function

function getWeight(){
      var weightBoxOne;
      var weightBoxTwo;
      var totalWeight;
      var box = .5;
   var quantity = document.dhform.quantity.value;
   var cardSize = document.dhform.cardSize.value;
   if(cardSize == 0.0141){
    if(quantity <= 1000){
     weightBoxOne = (quantity * cardSize) + box;
     totalWeight = weightBoxOne;
    }else if(quantity > 1000 && quantity <= 2000){
     weightBoxOne = (1000 * cardSize) + box;
     weightBoxTwo = ((quantity - 1000) * cardSize) + box;
     totalWeight = weightBoxOne + weightBoxTwo;
    }else if(quantity > 2000 && quantity <= 3000){
     weightBoxOne = (1000 * cardSize) + box;
     weightBoxTwo = (1000 * cardSize) + box;
     weightBoxThree = ((quantity - 2000) * cardSize) + box;
     totalWeight = weightBoxOne + weightBoxTwo + weightBoxThree; 
    }else if(quantity > 3000 && quantity <= 4000){
     weightBoxOne = (1000 * cardSize) + box;
     weightBoxTwo = (1000 * cardSize) + box;
     weightBoxThree = (1000 * cardSize) + box;
     weightBoxFour = ((quantity - 3000) * cardSize) + box;
     totalWeight = weightBoxOne + weightBoxTwo + weightBoxThree + weightBoxFour;
    }else{
     weightBoxOne = (1000 * cardSize) + box;
     weightBoxTwo = (1000 * cardSize) + box;
     weightBoxThree = (1000 * cardSize) + box;
     weightBoxFour = (1000 * cardSize) + box;
     weightBoxFive = ((quantity - 4000) * cardSize) + box;
     totalWeight = weightBoxOne + weightBoxTwo + weightBoxThree + weightBoxFour + weightBoxFive;
    }
   }else if(cardSize == 0.00949){
    if(quantity <= 4000){
     weightBoxOne = (quantity * cardSize) + box;
     totalWeight = weightBoxOne;
    }else{
     weightBoxOne = (4000 * cardSize) + box;
     weightBoxTwo = ((quantity - 4000) * cardSize) + box;
     totalWeight = weightBoxOne + weightBoxTwo;
    }
   }
   document.rates.weight.value = totalWeight;
  }
  //-->

this is the form that was originally posting

<form action="getRates.php" name="rates" method="post" onSubmit="popupform(this, 'join')">
                          <table style="width: 216px">
                            <tr>
                              <td style="width: 115px; height: 49px;"><span class="style16">Weight</span><br/>
                                  <input type="text" id="weight" name="weight" size="10" maxlength="4"/>
                              </td>
                              <td align="right" style="width: 68px; height: 49px;" valign="top"><span class="style16">Zip Code</span><br/>
                                  <input type="text" id="zip" name="zip" size="10" maxlength="5"/>
                              </td>
                            </tr>
                            <tr>
                              <td style="width: 115px">
         <input name="submit" type="submit" value="Get Rate Costs" style="width: 138px" />
  • 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-14T19:10:33+00:00Added an answer on May 14, 2026 at 7:10 pm

    I’ve done a similar thing by passing the JavaScript variables into hidden fields and posting them in the form as usual.

    Just add a few hidden fields to your form with tags like this:

    <input type="hidden" id="hidden-field-1" value="">

    Then you can adjust the value of the hidden field to match your JavaScript variable and pass the value on to the next page:

    document.rates.hidden-field-1.value = totalWeight;
    

    Just keep in mind that this form of JavaScript (which I took directly from your post) will only work reliably in Internet Explorer … A better way would be to use:

    document.forms['rates'].hidden-field-1.value = totalWeight;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a application that allows a user to choose some parameters for a
Right now I have a JSP page that allows to sort some items, when
I have a web page that allows users to insert form input objects with
I have a web form against a white background that allows the user to
I have a page that allows the user to download a dynamically-generated file. It
I have a page that contains a user control that is just a personalized
I have a page in my site that has allows users to search for
Im trying to build a page that will allow a user to select a
Im trying to create a page that allows a user to select a maximum
I have a page that is generated which inserts an HTML comment near the

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.