Multiple requests from a form

Results 1 to 3 of 3

Thread: Multiple requests from a form

  1. #1
    Join Date
    Dec 1969

    Default Multiple requests from a form

    &nbsp;<BR>********I want to pass the dates to the next page and put them in an array. Here is my first form.*********<BR><BR>****************Form1.asp*** ***************<BR>&#060;form method=post action=form2.asp&#062;<BR>&#060;input type="text" name="date1" value="12/10/2001"&#062;<BR>&#060;input type="text" name="date2" value="12/12/2001"&#062;<BR>&#060;input type="text" name="date3" value="12/15/2001"&#062;<BR>&#060;input type="text" name="date4" value="12/20/2001"&#062;<BR>&#060;input type="text" name="date5" value="12/25/2001"&#062;<BR>&#060;input type=hidden name=count value=5<BR>&#060;input type="submit" value="Step Three" name="Step Three"&#062;<BR>&#060;/form&#062;<BR><BR>I need to request date1, date2, date3, date4 and date5 from form1.asp and put them in an array.<BR><BR>Where the (*count*) is where I would like to use the variable count to let the program know which date I am requesting. I know this probably isn&#039;t the best way but my brain is fried. Please help if you can. Thanks.<BR>****************Form2.asp************** ****<BR>count = 1<BR>do until count = request.form("count")<BR>if count = 1 then<BR>strdate = request.form("date(*count*)")<BR>else<BR>strdate = strdate & ", " & request.form("date(*count*)")<BR>end if<BR>count = count + 1<BR>loop<BR><BR>DateArray = split(strdate, ",")<BR>For iLoop = LBound(DateArray) to UBound(DateArray)<BR>response.write DateArray(iLoop)<BR>Next

  2. #2
    Join Date
    Dec 1969

    Default Replace with following

    &#060;input type=hidden name=count value="5"&#062; &#039;always use correct html<BR><BR>Dim Count, DateArray(), i<BR><BR>Count = Cint(request.form("count")) -1<BR>Redim DateArray(Count)<BR><BR>For i = 0 to Count<BR> DateArray(i) = CDate(request.form("date" & (Count+1))<BR>Next<BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: Multiple requests from a form

    give all the fields the same name, then you get a comma seperated string with each value. Then it&#039;s easy to use the Split() function to get the values in the array.

Posting Permissions

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