Web Development

Dumping Form Information Onto a Web Page

Dumping Form Information Onto a Web Page

There comes a time when you have to create very complex, very comprehensive online forms consisting of 30 to 40 fields. While debugging the form output, or while validating the individual form fields (for example, if all the fields have been filled), you need to dump all the form field with their names and with their respective values onto a web page so you can see exactly what is coming from where. This tutorial tells you how to do that.

Suppose we have the following form. To make the example shorter, I have not used many fields.

<form method=post action=showfields.asp>
<p>Name: <input type=text name="name" size=20><br>
Age: <input type=text name="age" size=20><br>
Location: <input type=text name="location" size=20><br>
Food: <input type=text name="food" size=20></p>
<input type=submit name="sub" value=Submit>
</form>

Now we write the code for the file showfields.asp

<%
For Each FieldVal in Request.Form()
Response.Write FieldVal & " -> " & Request.Form(FieldVal) &
"<br>"
Next
%>

About the author

Written by Amrit Hallan.

Amrit Hallan is a freelance web developer. You can follow the link below to checkout his website.

If you found this post useful you may also want to check these out:

  1. Ensuring Two Form Fields Have Identical Information
  2. Designing Consistent Form Field Sizes
  3. Emailing Form Data with ASP
  4. Copying Billing Form Fields Into Shipping Fields
  5. User Feedback HTML Form
  6. Form Required Fields JavaScript Check