Okay, I've been tearing my hair out all morning over this.
I'm creating a dynamic set of forms, in which a user progresses through (answers a question, goes to the next, answers that, etc). I created a template which gets included on every one of these pages the user goes through, called answers.cfm.
In answers.cfm, a query gets all the questions in the database, then steps through the questions one at a time to see if FORM.Question# exists, if it does, it outputs the Question #, the Question, and the user's answer to it, and sticks a hidden field with the same name so that it's passed to the next form as well.
If that didn't confuse you, here's my problem. It all works grand up until I try to set the hidden field's value equal to the field that was passed and then print out the contents of that field. I know my problem is that I'm setting the variable equal to the NAME of the field and not the value, but I'm stuck! I've tried about a hundred different ways to do this and I either get errors because of syntax or I simply get the NAME of the field.
Can anyone help?
<cfquery name="getAnswers" datasource="MyData">
SELECT QuestionID, QuestionText
<cfif IsDefined ("FORM.Question#getAnswers.QuestionID#")>
<cfset Question = "Question" & "#getAnswers.QuestionID#">
<cfset MyFORM = "FORM.Question" & #getAnswers.QuestionID#>
<div class="answers">#Variables.Question#. #getAnswer.QuestionText#</div>
<input type="hidden" name="#Variables.Question#" value=#Variables.MyFORM#>