Submitting Arrays with Forms

Results 1 to 2 of 2

Thread: Submitting Arrays with Forms

  1. #1
    brian k Guest

    Default Submitting Arrays with Forms

    Hi all,<BR><BR>I am trying submit the contents of an array to another asp page and then rewrite the contents of the array to that page.<BR><BR>In my first ASP page the following code puts terms into an array:<BR><BR>arrCount = 0<BR>While .....<BR> <BR>arrayTerms(arrCount) = strTerm<BR>arrCount = arrCount + 1<BR> <BR>Wend<BR><BR>After while loop I have this Form, with arrayTerms(30) as a hidden field:<BR><BR>&#060;FORM ACTION=editTerm.asp?id=2 METHOD=POST&#062;<BR><BR>&#060;INPUT type="hidden" value="&#060;%=arrayTerms(30)%&#062;" name=array&#062;<BR>&#060;INPUT type="hidden" value="&#060;%=arrCount%&#062;" name=arrCount&#062;<BR><BR><BR>&#060;INPUT type="submit" value="Use Propose Terms" name=yesnoBtn&#062;<BR>&#060;/FORM&#062;<BR><BR>In my 2nd asp page that I submit this form to (editTerm.asp) I try to accept the contents of the array using Request.Form as follows:<BR><BR>Dim arrCount, arrayTerms(30)<BR> <BR> <BR>arrayTerms(30) = Request.Form("array")<BR>arrCount = Request.Form("arrCount") <BR><BR>Do Until arrCount &#060; 0<BR> Response.Write arrayTerms(arrCount) &"<BR>" <BR> arrCount = arrCount - 1<BR>Loop<BR> <BR><BR>This Code does display the contents of the array.<BR>If I put the &#039;Do Until Loop&#039; into by first page after I fill the array, the contents of the loop display fine.<BR><BR>Any ideas<BR><BR>Brian!

  2. #2
    Rana Hossain Guest

    Default RE: Submitting Arrays with Forms

    you can&#039;t do it that way. What its doing now is saving the 31 the value of the array to the form on a field called array<BR>&#060;INPUT type="hidden" value="&#060;%=arrayTerms(30)%&#062;" name=array&#062; <BR><BR>Either use<BR>for i = 0 to ubound(arrayTerms)<BR>response.write("&#060;input type=""hidden"" value=""" & arrayTerms(i) & """ name=""array" & i & """&#062;"<BR>next<BR><BR>and do the same thing on the 2nd page for retrieving. Though a better solution might be to write one hidden field by joining all the items with a delimeter, and use split on the next page. Should be faster.<BR>

Posting Permissions

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