Thanks! I knew there would have to be a simple way.
One question tho. Went back and read the documentation on Request.FormCount() and am wondering if I shouldn't just leave out the parameter which will return the number of parameters being passed from a potential Form Post?
if Request.FormCount() > 0
Or do I indeed need to look for a specific named parameter to make this work?
Thanks!
Joe Bigelow
HV/Net
Sent by FoxWeb Support on 02/03/2003 12:20:52 AM:
You could use the following code:
if Request.FormCount("foobar") > 0 lc_foobar = Request.Form("foobar") else lc_foobar = Request.QueryString("foobar") endif |
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:
lc_foobar = Request.Item("foobar") |
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.
FoxWeb Support Team support@foxweb.com email |
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")
else
lc_foobar = Request.Form("foobar")
endif
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.
JB