• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 183
  • Last Modified:

Capturing All Variables

I need to capture all the variables from a POST submitted form. Take in mind that the fields in this form are unknown, that means the CFM template is a generic one. It's easy with GET submitted form because one can use CGI.QUERY_STRING and list manipulation functions. I can't seem to find an environment variable like CGI.QUERY_STRING to handle POST submitted forms. Help?
0
chaduka
Asked:
chaduka
1 Solution
 
OeilNoirCommented:
can you post a part of your code?
0
 
nathansCommented:


 <CFLOOP INDEX="form_element" LIST = "#FORM.fieldnames#">


<cfset Item#form_element# = #FORM.fieldnames#>

<cfset Value#form_element# = #Evaluate(FORM.fieldnames)#>

</CFLOOP>


The var Form.fieldnames is a list of all of the fields comma delimited.

ex:  field1,field2,field3

or

ex:  first,last,address

Hope this helps.

0
 
chadukaAuthor Commented:
Aaaaah, exactly what I am looking for.

Thanx a lot.
0
 
danrosenthalCommented:
the line...

<cfset Value#form_element# = #Evaluate(FORM.fieldnames)#>

should be

<cfset Value#form_element# = #Evaluate(form_element)#>


0
 
chadukaAuthor Commented:
Thanx,

I preferred to do something like this:

       <cfset fieldNamesArray = ArrayNew(1)>
       <cfset fieldValuesArray = ArrayNew(1)>
       <cfset arrayIndex = 1>

       <cfset formFieldNamesArray = ListToArray(form.fieldnames, ",")>

       <cfloop index="fieldName" list="#form.fieldNames#">

        <cfset fieldNamesArray[arrayIndex] = #fieldName#>
        <cfset fieldValuesArray[arrayIndex] = #evaluate(fieldName)#>
        <cfset arrayIndex = IncrementValue(arrayIndex)>

       </cfloop>
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now