Re: Percentages Form Variables

2011-03-04 Thread Michael Grant
You might also want to consider the shorthand: correctanswers++ rather than correctanswers = correctanswers+1. On Thu, Mar 3, 2011 at 11:11 PM, Azadi Saryev azadi.sar...@gmail.comwrote: Something like this: a) at the top of your action page add: cfset ttlquestions = 5!--- total number of

Re: Percentages Form Variables

2011-03-04 Thread Scott Brady
Assuming, of course, that John is on CF8+. Scott On Fri, Mar 4, 2011 at 4:22 AM, Michael Grant mgr...@modus.bz wrote: You might also want to consider the shorthand: correctanswers++ rather than correctanswers = correctanswers+1. -- - Scott Brady

Re: Percentages Form Variables

2011-03-04 Thread John Eubanks
oops, typo in the round() function... it should be: #round( (correctanswers/ttlquestions)*100 ) [i had a comma in there which should not be there...] On 04/03/2011 12:11 , Azadi Saryev wrote: Azadi, many, many thanks. Works like a charm. :-)

Percentages Form Variables

2011-03-03 Thread John Eubanks
Anyone know how to calculate a percentage from form variables. I have a simple quiz (five questions) with multiple choice answers. I have the correct answers set using cfset on the processing page. However, I need to run a percentage so the display shows something like: Score: 80%. Here

Re: Percentages Form Variables

2011-03-03 Thread Azadi Saryev
Something like this: a) at the top of your action page add: cfset ttlquestions = 5!--- total number of q's in the test --- cfset correctanswers = 0 b) in the table showing answers in your action page add cfset correctanswers = correctanswers+1 to all your cfif blocks like so: cfif Form.Q1 EQ

Re: Percentages Form Variables

2011-03-03 Thread Azadi Saryev
oops, typo in the round() function... it should be: #round( (correctanswers/ttlquestions)*100 ) [i had a comma in there which should not be there...] On 04/03/2011 12:11 , Azadi Saryev wrote: Something like this: a) at the top of your action page add: cfset ttlquestions = 5!--- total