ASP Forms Get
When you pass information from an HTML form, using the Get method, to an ASP page from processing, you can retrieve the information using ASP's QueryString Collection. In the previous lesson we created "tizagForm.html" that sent information to "tizagGet.asp" for processing. Below is that HTML code.nullvoid.html Code:
<form method="GET" action="nullvoidGet.asp">
Name <input type="text" name="Name"/>
Age <input type="text" name="Age"/>
<input type="submit" />
</form>
ASP QueryString Variables
The form data we want resides within the Request Object's QueryString collection. In this collection there is an entry for each individual Form Input from our HTML Form. The input tag's name attribute is the key needed to access data for that Input element.Here we create a simple ASP processor that will store the contents of each the two items in our QueryString into variables and then print their values to the web page.
Save your ASP file as "tizagGet.asp" and save it in the same directory as "tizagForm.html".
tizagGet.asp Code:
<%
Dim name, age
name = Request.QueryString("Name")
age = Request.QueryString("Age")
Response.Write("Name: " & name & "<br />")
Response.Write("Age: " & age & "<br />")
%>
0 comments:
Post a Comment