Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts

    autoSumForm question

    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
    Leonard Whistler

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Are those the only text boxes in the form? As in, if you had textboxes a,b,c would those be the only ones?

  • #3
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Quote Originally Posted by Brandoe85
    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);
    Last edited by Len Whistler; 10-21-2005 at 12:52 AM.
    Leonard Whistler


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •