Hey guys-
I was hoping you could help me with two extremely simple arrays, as I am not very good with them. I am using VBScript in an ASP page. Basically, I have two arrays, one in which output is created based only on array elements that aren't null or 0. I have a second array in which I want to place the corresponding title in front of the the output placed by the first array. What I need to do is equate the indexes so that I'm printing the two elements of data with the same index in each array, but I can't figure out how to retrieve the index. Here is an example of some of my code:
Dim TitleArray(3)
Dim DataArray(3)
Dim NumColumns
Dim NumColMax
TitleArray(0) = "First Name: "
TitleArray(1) = "Reserved: "
TitleArray(2) = "Last Name: "
DataArray(0) = Request.Querystring("FirstName")
DataArray(1) = Request.Querystring("Reserved")
DataArray(2) = Request.Querystring("LastName")
NumColumns = 0
NumColMax = 2
For Each Elem in DataArray
If Elem <> "" And Elem <> "0" Then
If NumColumns < NumColMax Then
Response.Write "<td>" & TitleArray(Elem) & Elem & "</td>"
NumColumns = NumColumns + 1
Else
Response.Write "</tr><tr><td>" & TitleArray(Elem) & Elem & "</td>"
NumColumns = 1
End If
End If
Next
The bold is the part that's wrong, but I can't figure out how to put the DataArray index value of each iteration into TitleArray to retrieve the proper corresponding element of TitleArray.
I'm figuring this is a simple problem. If you need more code, let me know.
Thanks in advance,
Patrick
I was hoping you could help me with two extremely simple arrays, as I am not very good with them. I am using VBScript in an ASP page. Basically, I have two arrays, one in which output is created based only on array elements that aren't null or 0. I have a second array in which I want to place the corresponding title in front of the the output placed by the first array. What I need to do is equate the indexes so that I'm printing the two elements of data with the same index in each array, but I can't figure out how to retrieve the index. Here is an example of some of my code:
Dim TitleArray(3)
Dim DataArray(3)
Dim NumColumns
Dim NumColMax
TitleArray(0) = "First Name: "
TitleArray(1) = "Reserved: "
TitleArray(2) = "Last Name: "
DataArray(0) = Request.Querystring("FirstName")
DataArray(1) = Request.Querystring("Reserved")
DataArray(2) = Request.Querystring("LastName")
NumColumns = 0
NumColMax = 2
For Each Elem in DataArray
If Elem <> "" And Elem <> "0" Then
If NumColumns < NumColMax Then
Response.Write "<td>" & TitleArray(Elem) & Elem & "</td>"
NumColumns = NumColumns + 1
Else
Response.Write "</tr><tr><td>" & TitleArray(Elem) & Elem & "</td>"
NumColumns = 1
End If
End If
Next
The bold is the part that's wrong, but I can't figure out how to put the DataArray index value of each iteration into TitleArray to retrieve the proper corresponding element of TitleArray.
I'm figuring this is a simple problem. If you need more code, let me know.
Thanks in advance,
Patrick