adment my basket total when the user clicks on a option?

Posted on 2005-03-07
Medium Priority
Last Modified: 2013-12-24
i want to adment my basket total when the user clicks on a option, how can this be done? i want somesort of drop down box with delivery options, that onced selected updated the basket total.

  <cfset variables.basketTotal = 0>
<cfoutput query="display_basket">
<cfset variables.basketTotal = variables.basketTotal + display_Basket.line_price>
  <table width="420" border="0">
    <tr valign="top">
      <td width="176"><strong>Product:
      </strong> #item#<br> <strong>Code:</strong>  <strong>Ref:</strong> #ref#</td>
      <td width="99"><strong>Price:</strong><br>
      <td width="131"> <a href="remove.cfm?ref=#ref#">Remove Item</a></td>
    <tr valign="top" bgcolor="##CCCCCC">
      <td><strong>Sub Total:</strong> #basketTotal#</td>

<table width="420" border="0">
    <td width="39">&nbsp;</td>
    <td width="236">&nbsp;</td>
    <td width="131" bgcolor="#CCCCCC"><b>Total:</b> <cfoutput>#basketTotal#</cfoutput></td>

Question by:pigmentarts
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 18

Expert Comment

ID: 13475345
Hi pigmentarts,

You can do something like this.

<script language="javaScript">
    function AutoSelect(JumpUrl) {
        window.location.href = JumpUrl;

Please select your country to calculate the freight cost:
<select name="Country" size="1" onChange="AutoSelect(this.options[Country.selectedIndex].value)">
    <option value="Order.cfm?Country=" selected>Select</option>
    <option value="Order.cfm?Country=Albania">Albania</option>
    <option value="Order.cfm?Country=Algeria">Algeria</option>
    <option value="Order.cfm?Country=American">American</option>
    <option value="Order.cfm?Country=Andorra">Andorra</option>

When they select an option, a country in this example, it reloads the Order.cfm page with the country parameter so that you can calculate freight / charges etc, etc.


Accepted Solution

kyle1830 earned 2000 total points
ID: 13476567
you could try this.  Using plucka's example of countries, if you know the value, then just recalculate a value for the form field with the total price.

<script language="JavaScript">
    function ReCalc(){
    var a = document.Test.aTotalPrice.value;
    var b = document.Test.Country.value;
    var c = (a*1+b*1);
    document.Test.bTotalPrice.value = c;

<form name="Test">
Original Total <input type="Text" name="aTotalPrice" value="10.00">
New Total <input type="Text" name="bTotalPrice" value="10.00">
<select name="Country" size="1" onChange="ReCalc(this.options[Country.selectedIndex].value)">
    <option value="0" selected>Select</option>
    <option value="1">Albania</option>
    <option value="2.50">Algeria</option>
    <option value=".75">American</option>
    <option value="1.50">Andorra</option>

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question