Home Tutorials IT Jobs Source Codes Certifications Discussion Forum
  Python Tutorials
Introduction
ASP - Setup
ASP - Running
ASP - First Script
Syntax
ASP - VBScript
ASP - Javascript
ASP - Operators
If Statement
Select
Variable
Array
Session
Cookies
String
Forms
Forms Get
Forms Post
Email Form
ASP Object
ASP Components
ASP Comments
Special Characters
DLL
ADO
ASP File
ASP Date
   IT Jobs
Software Jobs
Networking Jobs
   Model Question Papers
BE Computer Science
MCA
BCA
Others
 
   

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 "codetellerForm.html" that sent information to "codetellerGet.asp" for processing. Below is that HTML code.

codetellerForm.html Code:

<form method="GET" action="codetellerGet.asp">
Name <input type="text" name="Name"/>
Age <input type="text" name="Age"/>
<input type="submit" />
</form>

Now we need to create our ASP web page "codetellerGet.asp" that will process this data.

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 "codetelleGet.asp" and save it in the same directory as "codetellerForm.html".

codetellerGet.asp Code

<%
Dim name, age
name = Request.QueryString("Name")
age = Request.QueryString("Age")
Response.Write("Name: " & name & "<br />")
Response.Write("Age: " & age & "<br />")
%>

ASP Get Simulation

After you have saved both files into a working ASP directory then if you were to enter the following information into "codetellerForm.html" and submit you would get the following:

codetellerForm.html Filled Out:

Name  Age 

asp-forms-get.asp Result:

Name: Fred
Age: 52

<< Previous | Next >>

Home  |  About us  | Privacy  |  Disclaimer  |  Contact us |  Advertise with us | Our Link Partners
All Rights Reserved 2009, CodeTeller.com