Dynamically generate Input Fields and insert field data into seperate rows
in a table
Using coldfusion and MSSQL
I need to insert each dynamically generated form field into a seperate
table row: For exxample:
If 5 questions are derived for a form, the user will enter the answer, the
questionid and answer needs to be inserted into table Questions:
questionID, anwers.
How do I loop over form to acquire the result?
This is what I tried:
<cfloop collection=#form# item="field">
<cfif field neq 'submit'>
<cfquery datasource="dstest">
INSERT INTO Questions (question_id, answer)
VALUES(#form.Question_ID#, #form.Answer#)
</cfquery>
</cfif>
</cfloop>
No comments:
Post a Comment