<% '******************************************************* '* ASP 101 Sample Code - http://www.asp101.com/ * '* * '* This code is made available as a service to our * '* visitors and is provided strictly for the * '* purpose of illustration. * '* * '* http://www.asp101.com/samples/license.asp * '* * '* Please direct all inquiries to webmaster@asp101.com * '******************************************************* %> <% Dim I Dim Fields ' Retrieve the number of fields we're dealing with. Fields = CInt(Request.Form("fields")) If Fields = 0 Then Fields = 1 %>
" method="post">

How many numbers would you like to enter?

<% ' Figure out which pass through the script we're on by the value ' of the submit button. If Request.Form("submit") = "Enter Numbers Now" Then %>

You indicated you wanted to enter <%= Fields %> numbers. Enter them below:

<% ' I'm prefilling the forms with some data for convenience to ' illustrates that the values are actually sent... in a real ' live situation you probably wouldn't enter a value. For I = 1 to Fields %> Number <%= I %>:
<% Next %> <% ElseIf Request.Form("submit") = "Submit Numbers" Then ' Done... display entries. In the real world you'd validate the ' entries and then do whatever you're doing to process the results ' here. I'm just echoing them back out to the browser. %>

You entered <%= Request.Form("number").Count %> numbers.

They were:

<% For I = 1 To Request.Form("number").Count Response.Write "Number " & I & ": " Response.Write Request.Form("number")(I) Response.Write "
" & vbCrLf Next %>

<% End If %>