View Full Version : Two arrays not the same length. Need them to be.

09-26-2007, 05:28 PM
Got one for you guys :confused:

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?

09-26-2007, 08:10 PM
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