Request.Querystring Advice

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • agantony
    New Member
    • Mar 2007
    • 1

    Request.Querystring Advice

    Hi All,

    I am new to programming so apologies if this is a basic question. I am using the following code to request the form field values. however all works as expected but the field order is mixed up.

    I have tried setting the tabindex on the fields,to try and resolve the issue, but no such luck.

    Is there any way i can sort the field order using the tabindex ?

    Thanks in advance.

    *************** *************** *************** *************** ********

    <%

    FiName = Request.Form("A TID")

    Set filesys = CreateObject("S cripting.FileSy stemObject")
    set resultfile = filesys.CreateT extFile("D:\res ults\"& FiName & ".txt")
    For each inputField In Request.QuerySt ring
    For Each inputValue in Request.QuerySt ring(inputField )
    resultfile .Writeline inputField & " = " & inputValue &"<BR>"
    Next
    Next
    %>
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    No, the request.query string order is a mystery. I've heard it discussed before and the general consensus is that it is not predictable. I've handled the problem like this, I named all of the fields numerically:
    <input name="inp1"><in put name="inp2"> etc. Then When I pulled it up I said:
    Code:
    dim i
    for i = 1 to 500 'some insanely high number
       if request("inp" & i) <> "" then
          response.write request("inp" & i) & "<br>" & vbNewLine
       end if
    next
    you could also put the names of the inputs in a numbered array like this
    Code:
    dim inputs(500)
    inputs(1) = "userName"
    inputs(2) = "favExoticAnimal"
    inputs(3) = "hairStyle"
    dim i
    for i = 1 to 500
       if request(inputs(i)) <> "" then
          response.write request(inputs(i)) & "<br>" & vbNewLine
       end if
    next
    Sorry I couldn't be more help.

    Jared

    Comment

    Working...