Creating A Survey Using Coldfusion: Stuck On The Table Data Insert
I'm trying to create a survey tool in Coldfusion and I'm stuck on one part. My tables are: t_forms (id, name, desc) t_questions (id, question, type, formid, order) t_cdata (id, em
Solution 1:
There is more than one way to have form fields associated with database identifier values. This is the one I find easiest to comprehend.
On the form page.
<cfoutputquery="somequery"><inputname="field1#databaseID#"><inputname="field2#databaseID#">etc
On the processing page.
<cflooplist="#form.fieldnames#"index="ThisElement"><cfifleft (ThisElement, 6) is "field1"><cfsetThisID = RemoveChars(ThisElement,1, 6)><cfsetThisField1Value = form[ThisElement]><cfsetThisField2Value = form['field2' & ThisID]>Continue to set variables and then do something with them. In fact, in this example, once you've set ThisID, setting more variables is optional. You can simply use the form variables directly using the synax shown.
Solution 2:
You will need to use an insert into cfquery.
You would use something like: INSERT INTO t_cqdata (q1 ,q2 ,q3 ,q4 ,q5 ,q6 ,q7) VALUES ( , , , , ,)
Post a Comment for "Creating A Survey Using Coldfusion: Stuck On The Table Data Insert"