![]() |
|
|
+ Search |
![]()
|
Mar 22nd, 2004 23:54
Jason Benson, Manjunath Naik,
There are two standard ways of passing information from HTML to ASP and
both are represented in the 2 main <FORM> methods.
The GET method:
Example Form:
<Form name="myform" action="destination.asp" method="get">
<input type="text" value="Hello World!">
<input type="Submit" value="Submit">
</form>
After submitting your form the Get Method will post your form with the
results in the URL (QueryString). (Example: destination.asp?
myfield=Hello
World!)
Notice the "?myfield=" Query String value in the URL
destination.asp can then call the results on the page using the
QueryString. Example:
<%Response.Write Request.QueryString("myfield") %> Would output: "Hello
World!" on your ASP page.
You can use the GET method without a form as well:
Calling the same destination page with: destination.asp?myfield=Whee!
The Request.QueryString("myfield") would now output "Whee!"
The POST Method:
Example Form:
<Form name="myform" action="destination.asp" method="POST">
<input type="text" value="Hello World!">
<input type="Submit" value="Submit">
</form>
Upon submitting this form you would see no QueryStrings (the page would
appear only as destination.asp in the URL bar).
To retrieve your form values you would use:
<%Response.Write Request.Form("myfield") %>
that would output "Hello World!" using the form provided.
I hope that helps
jb
© 1999-2004 Synop Pty Ltd