2 Replies - 11589 Views - Last Post: 01 November 2005 - 07:35 PM Rate Topic: -----

#1 snetter  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 17-May 05

Form variables collection

Posted 01 November 2005 - 03:46 PM

hey, a quick question for everyone out there...

I have an ASP page that is a simple form, but with many fields. Upon submitting the form I want to create a page that itterates through the form variables and prints them out. It must show all the fields, regardless of whether they where filled in and it needs to show them in the order they appear.

My attempt looked like this:

<%For Each key in Request.Form%>
  <td><%= key %></td>
  <td><%= Request.Form(key) %></td>
<% next %>

However that spits them out in a random order and only shows fields that have a value. Is there a collection other than Request.Form or a different approach that would give me my desired result?

Is This A Good Question/Topic? 0
  • +

Replies To: Form variables collection

#2 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1953
  • View blog
  • Posts: 20,377
  • Joined: 17-March 01

Re: Form variables collection

Posted 01 November 2005 - 03:50 PM

I'm not sure there is a way the page knows in what order the fields were submitted... you could pass a hidden field with a list of field names and loop over that, then you could control the order they display.
Was This Post Helpful? 0
  • +
  • -

#3 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 250
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Form variables collection

Posted 01 November 2005 - 07:35 PM

Skyhawk is right...pass one hidden variable that is a comma delited list of all fields on the first page. On the second page, split the hidden variable on the comma...this will give you an array of all fields names...loop through the array and display.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1