Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 3 of 3 FirstFirst 1 2 3
Results 21 to 24 of 24
  1. #21
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Er... Because you're never changing $POST[STNO]? By the way, you should be putting all of the subscripts in quotes ($_POST['STNO']) when they aren't variables. It seems more likely that you want your loop to be:
    PHP Code:
    while ($_POST['STNO'][$i] != NULL
    Or maybe:
    PHP Code:
    while ($i count($_POST['STNO']) 

  2.  

  3. #22
    Member
    Join Date
    Jun 2007
    Location
    Scotts Valley, CA
    Posts
    49
    Member #
    15405
    Thanks, Shadowfiend. That worked well (opted for choice #2). I had tried the first option initially, but wasn't able to get it to work.

    Definitely appreciate the help, and will continue to post as I make progress. Hopefully this benefits the forum.

    Cheers,

    K.

  4. #23
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    I preferred option 2, as well, it turns out. It's cleaner. Glad to see you caught that

  5. #24
    Member
    Join Date
    Jun 2007
    Location
    Scotts Valley, CA
    Posts
    49
    Member #
    15405
    So now that I've got that part of things working, I started on the script to sum the rows in the form, giving a total, then multiplying it by the price to give an extended cost.

    Here's the javascript I used to sum and multipy the rows:
    Code:
    function sumQuantities()
    {
    i=0
    while(i < document.orderForm.elements.length)
    {
    if((i%12==0)&&(i!=0))
    {
    var a = i-3;
    var b = i-4;
    var c = i-5;
    var d = i-6;
    var e = i-7;
    var f = i-8;
    var g = i-9;
    var h = i-10;
    var j = i-1;
    var k = i-2
    
    document.orderForm.elements[a].value=(document.orderForm.elements[b].value-0) + (document.orderForm.elements[c].value-0) + (document.orderForm.elements[d].value-0) + (document.orderForm.elements[e].value-0) + (document.orderForm.elements[f].value-0) + (document.orderForm.elements[g].value-0) + (document.orderForm.elements[h].value-0);
    document.orderForm.elements[j].value= (document.orderForm.elements[a].value-0)*(document.orderForm.elements[k].value-0);
    }
    i++;
    }
    }
    Now I'm trying to figure out how to validate the form, so that I know all the totals in the units column either = 0 or are greater than a minimum. My difficulty is that all the validation methods I've run into emphasize calling out the field to be validated by name, which doesn't work here, as my code will be generating lots of different order forms dynamically, depending on who's using it and what season they're after.

    Can anyone steer me right to hunt this down?

    Cheers,

    James


Page 3 of 3 FirstFirst 1 2 3

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:42 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com