469,328 Members | 1,247 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Passing parameters with 'for each Item in resuest.form....'

I have a mulitpage form that I do not record the information into a dbase
until the end.

I need to pass the field values form on form to the next. I have the code
for automatically
generating the 'hidden fields' but cannot figure out how to code it to
automatically generate
the assignment statements.

For example:

Code for passing Hidden Fields.....

<%
for each Item in request.form
response.write "<input type=hidden name=" & Item & " value=""" &
request.form(Item) & """>"
next
%>
Code for assigning: (Does not work!)

<%
for each Item in request.form
response.write "<%" & Item & " =request.form(""" & request.form(Item)
& """)"%>"
next
%>

The output should look like this: <%FName = request.form("FName")%>

Thanks,

Mikeal


Jul 19 '05 #1
3 8566
> response.write "<%" & Item & " =request.form(""" &
request.form(Item)
& """)"%>"


This won't work. ASP gets processed once, not twice.

Do you really need dynamic variable names? If so, you can use EXECUTE, I
think. (Look up the EXECUTE and EVAL keywords in VBScript documentation.)

However, as others will also point out, this is a very lazy and inherently
dangerous way to code... which is why I'm not willing to provide a working
code sample.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #2
What Aaron said.

Ray at work

"Mike" <mike4532> wrote in message
news:u2**************@TK2MSFTNGP09.phx.gbl...
Code for assigning: (Does not work!)

<%
for each Item in request.form
response.write "<%" & Item & " =request.form(""" & request.form(Item) & """)"%>"
next
%>

Jul 19 '05 #3
> Code for assigning: (Does not work!)

<%
for each Item in request.form
response.write "<%" & Item & " =request.form(""" & request.form(Item) & """)"%>"
next
%>


Try this...

for each item in request.form
eval(item) = request.form(item)
next
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Harolds | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by listenups61195 | last post: by
reply views Thread by Purva khokhar | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.