faqts : Computers : Programming : Languages : Asp : ASP/VBScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

7 of 13 people (54%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

How to HTML Component values pass values to ASP procedure

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