INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Adding Dropdown Form Values

Adding Dropdown Form Values

(OP)
i Have the Following Code and was Wanting to try and get all values selected to add up or Subtract from Initial Value shown, I've tried to work on this and Kind of stuck, can anyone help me out... thanks all

#// --------CODE START --------------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Items Values add Subtract</title>
<style type="text/css">
<!--
.style5 {font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; }
.style7 {font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; }
-->
</style>
</head>

<body>
<form action="submit.php" method="get" name="submit">
<table width="235" border="0" cellpadding="1" cellspacing="1">
<tr>
<td width="225" colspan="2"><span class="style5">Item Value1
<select name="Values1" onChange="">
<option name="Val0-0" value="$00.00">-----Select-------</option>
<option name="Val1-1" value="$32.00">ItemValue1</option>
<option name="Val1-2" value="$52.00">ItemValue2</option>
<option name="Val1-3" value="$82.00">ItemValue3</option>
</select>
</span></td>
</tr>
<tr>
<td colspan="2"><span class="style5">Item Value2
<select name="Values2" onChange="">
<option name="Val2-0" value="$00.00">-----Select-------</option>
<option name="Val2-1" value="$32.00">ItemValue1</option>
<option name="Val2-2" value="$52.00">ItemValue2</option>
<option name="Val2-3" value="$82.00">ItemValue3</option>
</select>
</span></td>
</tr>
<tr>
<td colspan="2"><span class="style5">Item Value3
<select name="Values3" onChange="">
<option name="Val3-0" value="$00.00">-----Select-------</option>
<option name="Val3-1" value="$32.00">ItemValue1</option>
<option name="Val3-2" value="$52.00">ItemValue2</option>
<option name="Val3-3" value="$82.00">ItemValue3</option>
</select>
</span></td>
</tr>
<tr>
<td colspan="2"><span class="style5">Item Value4
<select name="Values4" onChange="">
<option name="Val4-0" value="$00.00">-----Select-------</option>
<option name="Val4-1" value="$32.00">ItemValue1</option>
<option name="Val4-2" value="$52.00">ItemValue2</option>
<option name="Val4-3" value="$82.00">ItemValue3</option>
</select>
</span></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2">Initial Value: <span class="style7">$378.00 </span></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="Submit" value="Submit Selection">
</div></td>
</tr>
<tr>
<td colspan="2"><span class="style5">Values Total: </span></td>
</tr>
</table>


</form>
</body>
</html>

RE: Adding Dropdown Form Values

And the code you have tried is??

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: Adding Dropdown Form Values

(OP)
heheh "the code i tried is??",

<head>
<script type="text/javascript">
function doEcho(objForm)
{
var total=0;
for (var i=1;i<=5;i++){
objSelect = objForm.elements["var" + i];
total += Number(objSelect.options[objSelect.selectedIndex].value);
}
objForm.display.value = total;
}
</script>
</head>
<body>
<form name="echo">
<select name="var1" onChange="doEcho(this.form)">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<select name="var2" onChange="doEcho(this.form)">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<select name="var3" onChange="doEcho(this.form)">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<select name="var4" onChange="doEcho(this.form)">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<select name="var5" onChange="doEcho(this.form)">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select><br>

<input type="text" name="display" onBlur="doEcho(this.form)" value="0" class="textfield" size="2" disabled>
</form>
</body>

RE: Adding Dropdown Form Values

Okay and what are the results YOU are getting, I can easily find what I get but it's your results that count [or not] (pun intended)

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: Adding Dropdown Form Values

(OP)
thanks Chris, i wrote my own answer, Getting the results i need , :)

But ? have you ever Stored paths of PDF Files into a MySQL database "not the Files themselves >? any good links to that

or any examples you could put forward would be great..

RE: Adding Dropdown Form Values

Quote:

have you ever Stored paths of PDF Files into a MySQL database "not the Files themselves >?

Yeah many times, it is only a simple fixed or variable width text field [CHAR(255) or VARCHAR(255) [ Preferred ] needed and an UPDATE or INSERT query.

However, it can't be done with javascript, (this being the js forum)

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close