Stuart... form fields should never be plain numbers. Just tack on the string "answer" to your form field and you'll be good:
this: form.answer4 instead of this: form.4 When you're comparing the answers, you could loop over how many questions there are instead of setting that part manually. A quick and easy way of doing this is to create a form variable called "answercount" which contains the number of questions the user has in their form. <input type="hidden" name="answercount" value="5"> Then, in the processing code, loop over that like so: <cfloop index="i" from="1" to="#FORM.answercount#"> <cfif GetQuizQuestions.answerID[i] eq #form.answer[i]#><cfset score = score + 1></cfif> </cfloop> Not tested but something along those lines should work for you. <!----------------//------ andy matthews web developer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --------------//---------> -----Original Message----- From: Saturday (Stuart Kidd) [mailto:[EMAIL PROTECTED] Sent: Monday, October 03, 2005 11:44 AM To: CF-Talk Subject: Online quiz Hi guys, I have 5 questions in my MS-SQL database and when i want to display them in an online quiz I loop them through like so: <cfform> <cfoutput query="blah"> <cfinput name="#questionID# value="answerID"> </cfoutput> </cfform> When these get submitted i look through my DB again to pull the answers. And do something like: <cfoutput query="GetQuizQuestions"> <cfif answerID eq #form.questionID#><cfset score = score + 1></cfif> </cfoutput> The problem i'm having is somehow looping through the #form.questionID#'s as I don't want to hard-code each one like below as in some quizzes they'll be less than 5 questions and some more: <cfif GetQuizQuestions .answerID eq #form.1#><cfset score = score + 1></cfif> <cfif GetQuizQuestions .answerID eq #form.2#><cfset score = score + 1></cfif> <cfif GetQuizQuestions .answerID eq #form.3#><cfset score = score + 1></cfif> <cfif GetQuizQuestions .answerID eq #form.4#><cfset score = score + 1></cfif> <cfif GetQuizQuestions .answerID eq #form.5#><cfset score = score + 1></cfif> Also, will it be a problem that my form names which are ID's will be numbers, ie 1 or 2 or 3 etc? Any help on this would be great, Thanks, Saturday ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219925 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

