ASP Form Collection

## ASP Tutorial

ASP HOME ASP Introduction ASP Install ASP Syntax ASP Variables ASP Procedures ASP Forms ASP Cookies ASP Session ASP Application ASP #include ASP Global.asa ASP Send e-mail

## ASP Objects

ASP Response ASP Request ASP Application ASP Session ASP Server ASP Error ASP FileSystem ASP TextStream ASP Drive ASP File ASP Folder ASP Dictionary ASP ADO

## ASP Components

ASP AdRotator ASP BrowserCap ASP Content Linking ASP Content Rotator

## ASP and AJAX

AJAX Intro AJAX ASP AJAX Database

## ASP Summary

ASP Quick Ref ASP Summary

## ASP Examples

ASP Examples ASP Quiz ASP Certificate

# ASP Form Collection

Complete Request Object Reference

The Form collection is used to retrieve the values of form elements from a form that uses the POST method.

## Syntax

Request.Form(element)[(index)|.Count]

Parameter | Description
--- | ---
element | Required. The name of the form element from which the collection is to retrieve values
index | Optional. Specifies one of multiple values for a parameter. From 1 to Request.Form(parameter).Count.

## Examples

### Example 1

You can loop through all the values in a form request. If a user filled out a form by specifying two values - Blue and Green - for the color element, you could retrieve those values like this:

<% for i=1 to Request.Form("color").Count
Response.Write(Request.Form("color")(i) & "<br>")
next
%>

Output:

Blue
Green

### Example 2

Consider the following form:

<form action="submit.asp" method="post">
<p>First name: <input name="firstname"></p>
<p>Last name: <input name="lastname"></p>
<p>Your favorite color:
<select name="color">
<option>Blue</option>
<option>Green</option>
<option>Red</option>
<option>Yellow</option>
<option>Pink</option>
</select>
</p>
<p><input type="submit"></p>
</form>

The following request might be sent:

firstname=John&lastname=Dove&color=Red

Now we can use the information from the form in a script:

Hi, <%=Request.Form("firstname")%>.
Your favorite color is <%=Request.Form("color")%>.

Output:

Hi, John. Your favorite color is Red.

If you do not specify any element to display, like this:

Form data is: <%=Request.Form%>

the output would look like this:

Form data is: firstname=John&lastname=Dove&color=Red

Complete Request Object Reference

## Your suggestion:

Your E-mail (optional):

Page address:

Description:

Close [X]

## Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

## WEB HOSTING

Best Web Hosting UK Reseller Hosting Wow! $5 SSD Hosting

## WEB BUILDING

Download XML Editor
FREE Website BUILDER FREE Website Creator

## WEB RESOURCES

Web Statistics Web Validation

## SHARE THIS PAGE