View Full Version : How to request an unknown number of variables

08-27-2007, 10:03 AM
Hi all,

I have a form and there are three drop down menus (adults, children, infants) which has the values from 0 to 10. My javascript code adds new text fields to the form when the drop down menu changes.
For Example:
Selected option is 0. When the client changes adults drop down to 2, children drop down to 1 and infants drop down to 1, I want the code add
<input type="text" name="adult1" /><br>
<input type="text" name="adult2" /><br>
<input type="text" name="child1" /><br>
<input type="text" name="inf1" /><br>
to the HTML.

So the number of variables are different. We get the number of adults, children, infants from the drop down menu values and text field names goes like adult1,2,3,4

How can I get these values to separate variables? Can anyone send an example code?


08-28-2007, 05:28 PM
Using a For Each loop will get the values of all form elements.

here is an example that will write them to the page.

For Each Item in Request.Form
Response.Write Item & " = " & Request.Form(Item) & "<br>"