469,275 Members | 1,754 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,275 developers. It's quick & easy.

forms collection and for next

I'm trying out some code cause of an idea I just got, but it won't work
for each item in Request.Form
Response.Write (Request.Form("item"))
Response.Write("<br>")
next
only one <br> per Request.Form("item") appears on the page, but no item
in Request.Form is written.
However I've learnt that "You can iterate through a collection using a
For Each item in ... Next loop."

Mats


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
2 2195
Mats wrote:
I'm trying out some code cause of an idea I just got, but it won't
work for each item in Request.Form
Response.Write (Request.Form("item"))


You just told it to write the contents of a variable called "item". I doubt
there is a variable with that name in your Forms collection.

What you really wanted it to do was write the contents of the variable whose
name is contained in the item variable. Like this*:

Response.Write Request.Form(item)

* You should not use the parentheses around the response.write argument -
the Write method does not return a value, so the parentheses are not needed
unless you are doing this in jscript.

HTH,
Bob Barrows


Jul 19 '05 #2
Mats wrote on 20 sep 2003 in microsoft.public.inetserver.asp.general:
I'm trying out some code cause of an idea I just got, but it won't work
for each item in Request.Form
Response.Write (Request.Form("item"))
Response.Write("<br>")
next
only one <br> per Request.Form("item") appears on the page, but no item
in Request.Form is written.
However I've learnt that "You can iterate through a collection using a
For Each item in ... Next loop."


<%
for each item in Request.form
Response.Write item & " = " & Request.form(item) & "<br>"
next
%>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Soryt | last post: by
3 posts views Thread by K.K. | last post: by
2 posts views Thread by Yuk Tang | last post: by
15 posts views Thread by c676228 | last post: by
11 posts views Thread by Kevin | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.