Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Post unknown amount of form variables 1

Status
Not open for further replies.

mainmast

Programmer
Jun 26, 2003
176
US
Hi all,

I need to be able to post every single form element's value to an ASP page. I would not know how many, what type, or the name of the element. I could have a form of 5 textboxes, a few radio buttons, a select menu, and more. Any ideas?

Thanks!
 
Use hidden inputs for everything that you don't want or need to display, textareas for values longer than for text inputs (like multi-line ones).

Lee
 
Let me clarify:

I'll have an ASP page on a server (lets say
Then, I'll have at least 30 seperate plain HTML files created by different people. In those HTML files there will be a form, and in that form there could be any amount of input elements, like textboxes, textareas, radio buttons, checkboxes, and more. I don't know what the name of these elements will be called, I don't know what value they'll contain, what type they are, or how many of them the form contains.

The form would point to in the action attribute. That page will display every single element of the form and the values of that form. I need to know how to do this, without knowing the things mentioned above.
 
You could try a For/Next loop on the Request object.

The following code assumes that the Form's method = POST
Code:
<%
Dim Foo
For Each Foo in Request.Form
  Response.Write Foo & " = " & Request.Form(Foo) 
  Response.Write "<br>" & vbCrLf
Next
%>
 
Also you need to be aware that the browser will not send anything for unchecked checkboxes.
 
Thanks - that is exactly what I needed Sheco.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top