Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Requesting the String in a Query String

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,55540
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> Requesting the String in a Query String
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Requesting the String in a Query String - 1/16/2008 6:58:41 AM   
  JBarbea1

 

Posts: 20
Score: 0
Joined: 3/27/2007
Status: offline
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
 
 
Post #: 1
 
 RE: Requesting the String in a Query String - 1/16/2008 9:24:33 AM   
  JBarbea1

 

Posts: 20
Score: 0
Joined: 3/27/2007
Status: offline
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.

(in reply to JBarbea1)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> Requesting the String in a Query String Page: [1]
Jump to:





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
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts