Article ID: 198808
Article Last Modified on 7/16/2004
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<B>
<%
If Request.Form <>"" Then
For each intNumItems in Request.Form
Response.Write Request.Form(intNumItems) & "<BR>"
Next
Response.Write "<HR>"
End if%>
</B>
<FORM NAME="MyForm">
<B>Enter the number of elements in the array: </B>
<INPUT TYPE="TEXT" NAME="numelements" VALUE="5">
</FORM>
<BR>
<INPUT TYPE="BUTTON" NAME="cmdButton" VALUE="Send To Server">
<Script Language="VBSCRIPT">
Dim MyArray()
ReDim MyArray(5)
Sub cmdButton_onClick()
intNumItems=Cint(Document.MyForm.numelements.value)
If intNumItems <> 0 Then
ReDim MyArray(intNumItems)
End if
'Fill in the array with the string of the word VALUE plus the counter number
For i = 0 to intNumItems
MyArray(i) = "Value " & i
Next
Dim i
i = Ubound(MyArray)
a = "<FORM NAME=" & chr(34) & "TempForm" & chr(34) & " ACTION=try.asp METHOD=POST><BR>"
For intNumItems = 1 to i
a = a & "<INPUT TYPE=" & chr(34) & "HIDDEN" & chr(34) & "Name=" & chr(34) & _
"item" & intNumItems & chr(34) & "Value =" & chr(34) & MyArray(intNumItems) & chr(34) & "> <BR>"
Next
a = a & "</FORM>"
Document.Write a
TempForm.Submit
End Sub
</Script>
</BODY>
</HTML>
Keywords: kbhowto kbcodesnippet KB198808