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>
This method supports more characters than GET or PUT.
The page the form is submitted to will not show the
parameters in the address window, and may be the main reason you
chose this method.
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") %>
A
Shortcut - Does it really matter?
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.
|