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

M

Mike

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
 
A

Aaron Bertrand - MVP

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.
 
R

Randy Rahbar

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top