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?
LVL 1
chadukaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

OeilNoirCommented:
can you post a part of your code?
0
Nathan Stanford SrSenior ProgrammerCommented:


 <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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.