I would like to collect data from a form, and store the data in an array. The field names in the form have been named.
totalQuestions
1Question
2Question
3Question
In order to put the values from these fields into the array I would like to run them through a loop.
(the number of questions will vary, totalQuestions is a hidden field that will store the number of questions.)
<cfloop index="i" from="1" to="#form.totalQuestions#">
<cfset aAnswers=evaluate(#form.#&i&#Question#)>
</cfloop>
I also tried switching the field names to:
totalQuestions
Question1
Question2
Question3
<cfloop index="i" from="1" to="#form.totalQuestions#">
<cfset aAnswers=evaluate("#form.Question#i"
>
</cfloop>
Does anyone have any suggestions as far as how I can accomplish this? Thanks
totalQuestions
1Question
2Question
3Question
In order to put the values from these fields into the array I would like to run them through a loop.
(the number of questions will vary, totalQuestions is a hidden field that will store the number of questions.)
<cfloop index="i" from="1" to="#form.totalQuestions#">
<cfset aAnswers=evaluate(#form.#&i&#Question#)>
</cfloop>
I also tried switching the field names to:
totalQuestions
Question1
Question2
Question3
<cfloop index="i" from="1" to="#form.totalQuestions#">
<cfset aAnswers=evaluate("#form.Question#i"

</cfloop>
Does anyone have any suggestions as far as how I can accomplish this? Thanks