Dumping Form Information Onto a Web Page

by Amrit Hallan
Thursday, 9th March 2006

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
%>


Amrit Hallan is a freelance web designer. For all web site development and web promotion needs, you can get in touch with him at amrit@bytesworth.com . For further details, visit http://www.bytesworth.com You can subscribe to his newsletter [BYTESWORTH REACHOUT] on Web Designing Tips & Tricks by sending a blank email at bytesworth-subscribe@topica.com.
View the original article Dumping Form Information Onto a Web Page