The previous FAQ described how to pass information from one page to another using the QueryString. To assimilate variables in the QueryString you can either use a form with METHOD="GET" or redirect the user to a URL which looks like:
You can also pass variables using the form METHOD="POST". This has the effect of "hiding" the parameters passed, since it is done on the server-side as opposed to having the client pass the information string to the server (as in the QueryString example above).
A POSTed form looks identical to a GETed form, except instead of
FORM="GET", we put
FORM="POST". Here is an
<FORM METHOD="POST" ACTION="myasp.asp">
... HTML here ...
In the file myasp.asp, we read the data the same way we do for QueryString
variables. We just use
more information on how to read variables using Request, please read the
You may be wondering why anyone would prefer using a GET over a POST or vice versa. They appear to be identicle. One benefit of a POST is that you can pass nonstandard characters with less hassle than through the QueryString. For example, say that you wanted to pass the string: "Hello my name is ?&!" Well, passing characters like ?, &, and " " can be cumbersome through the QueryString. When variables will hold such characters, it is often wiser to put them in a POSTed FORM as opposed to a GETed one.
Also, in some older browsers there is a limit to the length of the QueryString. If you need to pass a lot of variables, be sure to not do it through the QueryString.
|FAQ Table of Contents||Passing Variables Between ASP Pages||Using Option Explicit|