PDA

View Full Version : ElseIf


austin322
07-11-03, 11:34 AM
I have put a little quiz on my site and it scores fine, but I can't get it to return the letter grade for the score. I have all of the Letter Grades stored in separate cookies. Here is the code I am trying to use:

<%
NumberQuestions=Request.Form("NumberQuestions")
score = Correct/NumberQuestions*100
score =ROUND (score, 0)
incorrect = NumberQuestions-Correct
LetterGrade=""
A1=Request.Cookies("A1")
A2=Request.Cookies("A2")
B1=Request.Cookies("B1")
B2=Request.Cookies("B2")
C1=Request.Cookies("C1")
C2=Request.Cookies("C2")
D1=Request.Cookies("D1")
D2=Request.Cookies("D2")
F1=Request.Cookies("F1")
F2=Request.Cookies("F2")

If F1 <= score AND score <= F2 then
LetterGrade="F"
ElseIf D1 <= score AND score <= D2 then
LetterGrade="D"
ElseIf C1 <= score AND score <= C2 then
LetterGrade="C"
ElseIf B1 <= score AND score <= B2 then
LetterGrade="B"
ElseIf A1 <= score AND score <= A2 then
LetterGrade="A"
End If
%>

Any help would be appreciated. Thanks!

Shane
07-11-03, 12:54 PM
Make sure your cookies are returning an integer, not a string


A1= cint(request.cookies("A1"))
...

austin322
07-11-03, 01:48 PM
Thanks, that worked great!