-
1
- #1
If you don't know for sure whether your program is going to be called with get or post data, you can access either very simply. The usual way way is to leave out which you're referring to (.Form or .QueryString), like:
With this method ASP will scan all of the Request collections for the variable specified. The problem with that method is that it scans all of the Request collections. This can be very inefficient, and can cause problems if your form fields have the same name as variables in other Request collections.
There is another method that also works: find which has data and assign it to another collection, then use that collection. Like this:
Will access the value of the form field "myField" whether it was passed via get or post.
It may come in handy to know that.
Tracy Dryden
Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.![[dragon] [dragon] [dragon]](/data/assets/smilies/dragon.gif)
Code:
Request("formfield")
There is another method that also works: find which has data and assign it to another collection, then use that collection. Like this:
Code:
Dim tmpColl
If Request.QueryString <> "" then
set tmpColl = Request.QueryString
elseif Request.Form <> "" then
set tmpColl = Request.Form
else
'there is no form data
end if
response.write "myField is " & tmpColl("myField")
It may come in handy to know that.
Tracy Dryden
Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
![[dragon] [dragon] [dragon]](/data/assets/smilies/dragon.gif)