I'd be suprised if it didn't throw a wobbly if you use numbers for your form
names. Best not to.
To answer the dynamic form names bit. Use array notation.
<cfloop from="1" to="10" index="i">
#FORM["myForm_" & i]#
</cfloop>
Ade
-----Original Message-----
From: Saturday (Stuart Kidd) [mailto:[EMAIL PROTECTED]
Sent: 03 October 2005 17:44
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219922
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54