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:219920
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