Using Forms to send information between ASP Pages
Many beginner ASP programmers have a hard time with this concept. Here is an example if
you want to use forms to transfer information between ASP pages. It is actually very
simple and is used quite often when building ASP applications.
Using a Form With Post
<form
action="somepage.asp" method=POST>
<input type ="text" value ="somevalue"
name ="somevariable">
<input type=submit>
</form>
Supports more characters than GET or PUT
The page the form is submitted to will not show the parameters in the address window
The ASP page the form is submitted to uses the following code to retrieve the variable
<%
somevariable = Request.Form("somevariable") %>
Using a Form with GET or PUT
<form
action="somepage.asp" method=GET>
<input type ="text"
value
="somevalue" name ="somevariable">
<input type=submit><input type=reset>
</form>
The number of characters is limited
The page the form is submitted to will show the parameters in the address window
The ASP page the form is submitted to uses the following code to retrieve the
variable
<%
somevariable = Request.Querystring("somevariable") %>
Something To Think About
You can simply use Request("somevariable")
and
it will retrieve it from the header no matter which of the 3 methods you used. This is
probably a little slower but it makes for easier coding if you are not worried about
milliseconds of time savings.
Also some versions of IE on the MAC do not work with
"PUT" and will give you a 404 error, so it is probably best just to
use "GET" though it is definitely a bug that they never seem to
fix. |