You could use the following code:
Alternatively, you could use the Request.Item method, which looks in the Query String, the POST data, cookies and server variables (in this order) for the specified field:
The only issue here is that you need to make sure that you don't send cookies with the name "foobar" from your server and you don't use server variable names for your fields.
Sent by Joe Bigelow on 02/02/2003 08:55:28 AM:
I have a number of scripts that need to respond to both form post and query string parameters. These scripts were originally written in 1.x and the ubiquitous FormField() would retrieve anything from anywhere. I'm finally moving up to 2.X and need to recast these programs into scripts. I know if I leave the 1.X compatibility on it will still work, but I'd like to actually shift the functionality.
So my question is this. From reading the documentation it appears that the Request.Form("foobar") will ONLY retrieve information from a Form Post and Request.QueryString("foobar") will ONLY retrieve information from after the "?" in a script call. Is this true or is one or the other ubiquitous as FormField() was in 1.x?
Assuming that they are differentiated in what type of information they are capable of retrieving, would the following work?
if Request.Form("foobar") != "C"
lc_foobar = Request.QueryString("foobar")
lc_foobar = Request.Form("foobar")
The "if" would determine the source of the information allowing me to accumulate passed information appropriately?
I know I could write wrapper scripts for each instance for each possibility, but that would triple the number of scripts necessary. I'd much rather have each script capable of everything necessary within itself.
Thanks in advance.