...

View Full Version : autoSumForm question



Len Whistler
10-20-2005, 09:15 PM
I have a php generated form that changes how many boxes are to be totalled. Ranges from 1 box to 10 or more. All would be named from a to z.

document.autoSumForm.total.value = (a * 1) + (b * 1);

Anyway to total a range of boxes from a to z. Something like:

document.autoSumForm.total.value = (a * 1) to (z * 1);

Sometimes it might be box "b,e,f,h,n" to total or "a,b,d" or "c,g,m,p" and so on.

Thanks

Brandoe85
10-20-2005, 09:22 PM
Are those the only text boxes in the form? As in, if you had textboxes a,b,c would those be the only ones?

Len Whistler
10-21-2005, 01:49 AM
Are those the only text boxes in the form? As in, if you had textboxes a,b,c would those be the only ones?

Thanks for the reply Brandoe85...

No..there is also QTY boxes, shipping box, sub-total box. But I have solved my problem, I have added a php foreach loop to generate the javascript.

document.autoSumForm.total.value = <?
foreach ($product_id as $val) {
$value = explode(" - ", $val);
echo "($value[3] * 1) + ";
}
?>(0 * 1);



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum