Classic ASP Reading Forms

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

Note: If you want to post large amounts of data (beyond 100 kb) the Request.Form cannot be used.

Arguments:

Request.Form(element)[(index)|.Count]
  • 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:

You can request form values by using the following example:

<% Request.Form("name") %>

The above example would display the value entered into the HTML field called "name".

This next example would allow you to reteive multiple values from fields of the same name.

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

You can grab all the data sent via a form by doing the following:

<% = Request.Form() %>

As we have not set a form field to get data from, it will return all data submitted.

Tutorial:

You can find out more about using Request.Form by reading our Form Tutorial:
Written By: S2H, 9th July 2006

Bookmark

Advertisement