Requesting the String in a Query String

Author Message
JBarbea1

  • Total Posts : 20
  • Scores: 0
  • Reward points : 0
  • Joined: 3/27/2007
  • Status: offline
Requesting the String in a Query String Wednesday, January 16, 2008 7:58 AM (permalink)
0
Ok folks, I know this question may sound stupid, or may even be easy for some of you, but I'm not familiar with the method.

I want to be able to request the string from a query string.  Not the actual value, but the string itself.

for instance:
home.asp?n=on&b=on

I want the n and b part.  I want to know which items are being passed, not the value.

The reason I am doing this is a print function.  If the user checks a box for printing it is usually displayed as (=on)  to the page its posting to.

So in essense, I want to be able to print a record where the box is checked (or by the id somehow)

so my logic is:

the id's will be the checkbox names (5=on&6=off&12=on)
so I will know to write a string for an IN CLAUSE in SQL

If 5 = on Then
variable = variable & (QueryString) & ","

I'd use the post method, but the list is dynamic, so I dont know what the query string is going to be.

I hope this makes some sort of sense.

Thanks


 
#1
    JBarbea1

    • Total Posts : 20
    • Scores: 0
    • Reward points : 0
    • Joined: 3/27/2007
    • Status: offline
    RE: Requesting the String in a Query String Wednesday, January 16, 2008 10:24 AM (permalink)
    0
    Ok, I found a solution with a little help from W3Schools

    <% Dim printIDs
    for i=1 to Request.QueryString("n").Count
      printIDs = printIDs & (Request.QueryString("n")(i) & ",")
    next
    %>
    <%
    Dim printIDsTrim, printIDsLen
    If printIDs <> "" then
    printIDsLen = Len(printIDs) -1
    printIDsTrim = Left(printIDs,printIDsLen)
    end If
    %>

    This gives me the numbers I was looking for from the query string, by adding a default value of the ID to the check box on the first page, it passes values (when checked) in the query string like so.

    n=5&n=12

    Then the printIDsTrim looks like this 5,12 and I can use it for my IN STATEMENT for SQL, giving me the recordset filter I was looking for.
     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9