Name
Form —
Request.Form
Synopsis
The
Form
collection allows you to retrieve the information input into an HTML
form on the client and sent to the server using the
POST
method. This information resides in the body
of the HTTP request sent by the client.
The Form collection, like the other ASP collections, has the following properties:
- Item
Represents the value of a specific element in the collection. To specify an item, you can use an index number or a key. In the case of the Form collection, the index number represents the number of the element on the HTML form. For example, suppose you have the following HTML form:
<FORM ACTION = "RecordPrefs.asp" METHOD = POST> Name: <INPUT TYPE = TEXT NAME = "Name"><BR> Color Pref: <SELECT NAME = "optColor"> <OPTION VALUE = "red" SELECTED>Red <OPTION VALUE = "blue" >Blue <OPTION VALUE = "green" >Green </SELECT><BR> Have a Modem? <INPUT TYPE = CHECKBOX NAME = "Modem"><BR> <INPUT TYPE=submit VALUE=submit> </FORM>
From within RecordPrefs.ASP, the first element (element 1) is "Name." The third element is "Modem." Note that the numbering begins with 1 (one).
- Key
Represents the name of a specific element in the Form collection. Just as each element's value is represented by the Item property, so each element's name is represented by its Key property.
If you do not know the name of a specific key, you can obtain it using its ordinal reference. For example, assume that you want to learn the key name for the third element in the collection and, subsequently, ...
Get ASP in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.