[thelist] ASP request.querystring(*) ?

Rob Smith rob.smith at thermon.com
Wed Apr 10 14:54:01 CDT 2002


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--
[ Picked text/plain from multipart/alternative ]
Greg, fyi thanks to you, I actually ended up with this to accept ambiguous
checkbox entry names from an ASP form, using method=GET:

<snip>
<%
   Dim Item,At
   At = "@"
	For Each Item in Request.QueryString
		If (InStr(Item, At)) then
			strSQL = "DELETE FROM CMSUserTable WHERE
[CMSUserID]= '" & Item & "'"
			DeleteUser.Open strSQL
    		end if
	Next
 %>
</snip>

I wanted to be able the Administrator to select a name from a long list of
names and select any and all names to be deleted. This would be easier if a
database wasn't involved that handled unique items.

Story behind this project:
I had a form that had check boxes and names with information next to them.
The administrator walks in and chooses to delete a user; clicks a checkbox;
clicks the submit button. The checkboxes were
name(d)="users.field.item("CMSUserID").value" so I could tell exactly which
checkbox was which. From that I wanted to know if the values were an email
address or other request.querysting garbage sent with the message. Once I
had that small piece of information:

text=on&moretext=on&stillmoretext=on&Sumbit=this
        moretext

I was able to tell the DB exactly who to remove from the DB.

Thanks again.

--------------

You can use a For Each loop:

Dim QSItem
For Each QSItem in Request.QueryString
    Response.Write (QSItem & " = " & Request.QueryString(QSItem) & "<br />")
Next

Note that if you have two or more items in the querystring with the same
name, Request.QueryString(QSItem) will return a comma-delimited list of
them.

Greg
--
!



More information about the thelist mailing list