Trouble Returning form Results in Order

Results 1 to 2 of 2

Thread: Trouble Returning form Results in Order

  1. #1
    Join Date
    Dec 1969

    Default Trouble Returning form Results in Order

    Could someone look at the following code and show me what I would change to swap a For Each ... Next into For ... Next in order that my mail form will return the results in the order they appear on the html form?<BR><BR>I know I need to replace the For Each myElement in Request.Form, but with what?<BR><BR>&#060;!-- Code Starts Here<BR><BR> For Each myElement in Request.Form<BR> Select Case Left(myElement,3)<BR> Case "txt","sel","rad":<BR> strBody = strBody & Replace(Mid(myElement,4,len(myElement)),"."," ") & _<BR> ": "<BR> if Len(Request.Form(myElement)) = 0 then<BR> strBody = strBody & "UNANSWERED"<BR> else<BR> strBody = strBody & Request.Form(myElement)<BR> end if<BR> <BR> strBody = strBody & vbCrLf<BR> <BR> Case "chk":<BR> strBody = strBody & Replace(Mid(myElement,4,len(myElement)),"."," ") & _<BR> ": " & Request.Form(myElement) & vbCrLf<BR> <BR> End Select<BR> <BR> Next<BR><BR>Ends Here --&#062;<BR><BR>Can&#039;t quite seem to get it to work as stated elsewhere on this site. <BR><BR>Thanks

  2. #2
    Dalibor Sver Guest

    Default RE: Trouble Returning form Results in Order

    In your case, I would use array of input fields on form (Not exactly array, because it&#039;s tricky in HTML elements - I had such a hard time with it using PHP - but names like txt1, txt2 ...)<BR>so on the form processing script I would have<BR><BR>intNumEl=request.form("number_of_eleme nts")<BR>for i=1 to intNumEl<BR>somearray(i)=request.form("txt" & i)<BR>next<BR><BR>You can also send hidden variables with values of data types of elements (txtdatatype1, txtdatatype2...)<BR>so you&#039;d have:<BR><BR>intNumEl=request.form("number_of_elem ents")<BR>for i=1 to intNumEl<BR>datatypearray(i)=request.form("txtdata type" & i)<BR>if datatypearray(i)=3 then<BR> somearray(i)=clng(request.form("txt" & i))<BR>elseif datatypearray(i)=8 then<BR> somearray(i)=cstr(request.form("txt" & i))<BR>...<BR>else<BR> somearray(i)=request.form("txt" & i)<BR>end if<BR>next<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