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 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2007
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Two arrays not the same length. Need them to be.

    Got one for you guys

    In a sproc I am grabbing all the records in a table with the same leaderID. In my HTML I have a "do while rs.EOF" loop that is creating a new <tr> to display each record. Simple enough.

    Each <tr> I have added a checkbox input and a hidden input. The checkboxes have the same name as well as the hiddens so on the next page I will be requesting them, spliting them, and putting them into two different arrays.

    Heres my problem:

    The arrays can be different lengths but I need them to be the same. If 10 records are displayed there will be 10 hidden inputs and 10 checkbox inputs. Then, for example, check 3 of the 10 checkboxes and submit the form. When I create the arrays on the next page one has a length of 9 (0 is the first number in an array) the other has a length of 2. I need them to match up.

    Is there a way to do this without substituting the checkbox for a select or radio input?

  • #2
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,065
    Thanks
    4
    Thanked 8 Times in 8 Posts
    It has nothing to do with radio buttons, checkboxes etc. It has to do with people counting from 1 and arrays always start at 0. the simple solution is to either add 1 to it like so my value=UBound(someArray) + 1 or start counting at 0


  •  

    Posting Permissions

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