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

Discussion in 'ASP General' started by Mike, Dec 11, 2003.

  1. Mike

    Mike Guest

    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
     
    Mike, Dec 11, 2003
    #1
    1. Advertising

  2. > 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/
     
    Aaron Bertrand - MVP, Dec 11, 2003
    #2
    1. Advertising

  3. Mike

    Ray at Guest

    What Aaron said.

    Ray at work

    "Mike" <mike4532> wrote in message
    news:...

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

    request.form(Item)
    > & """)"%>"
    > next
    > %>
     
    Ray at, Dec 11, 2003
    #3
  4. Mike

    Randy Rahbar Guest

    > 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
     
    Randy Rahbar, Dec 11, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Blair
    Replies:
    1
    Views:
    412
    Eliyahu Goldin
    Aug 3, 2005
  2. Tjerk Wolterink

    xsl:for-each for each 3 elements problem

    Tjerk Wolterink, Nov 3, 2004, in forum: XML
    Replies:
    3
    Views:
    432
    Tjerk Wolterink
    Nov 3, 2004
  3. Ramon F Herrera
    Replies:
    8
    Views:
    486
    Pascal J. Bourguignon
    Sep 13, 2009
  4. Drew

    For each item in Request.Form

    Drew, Jan 24, 2006, in forum: ASP General
    Replies:
    14
    Views:
    276
    Bob Barrows [MVP]
    Jan 24, 2006
  5. Pat Maddox
    Replies:
    6
    Views:
    158
    Marcin Mielżyński
    Jan 20, 2006
Loading...

Share This Page