% 'parameter inputs '1. NextQuestion : number of next question to diplay starts at 1 '2. QuizType: options: Reptiles_Common, Amphibians_Common, any other param does reps & amphibs If Len(Request.QueryString("NextQuestion")) < 1 then NextQuestion = 1 'count number of entries in quiz database Dim Counter Counter = GetNumberOfEntries() 'randomly select ten unique entries Dim Questions(10), Rnum, F, G, Exists, QuestionString, QuestionNo Randomize For F = 1 to 10 do 'Generate random number Rnum = Int((counter-1+1)*Rnd+1) Exists = false 'Check if number already selected for G = 1 to 10 If Questions(G) = Rnum then Exists = true end if Next 'G 'check if reptiles only quiz If Request.QueryString("QuizType") = "Reptiles_Common" then 'reject non-reptile animals If GetAnimalType(Rnum) <> "reptile" then Exists = true 'hence ingore this entry as it is not a reptile End if End if 'check if amphibians only quiz If Request.QueryString("QuizType") = "Amphibians_Common" then 'reject non-amphibian animals If GetAnimalType(Rnum) <> "amphibian" then Exists = true 'hence ingore this entry as it is not an amphibian End if End if 'Allocate accepted random number to array string if not Exists then Questions(F) = Rnum end if loop until Exists = false next 'F 'Compile a comma-delimited string of question numbers QuestionString = "" For F = 1 to 9 QuestionString = QuestionString & Questions(F) & "," Next 'F QuestionString = QuestionString & Questions(10) Else 'if NextQuestion <> 1 NextQuestion = Request.QueryString("NextQuestion") QuestionString = Request.QueryString("QuestionString") End If %> <% 'Start timer If request.querystring("StartTime") = "" then StartTime = Time else StartTime = Request.QueryString("StartTime") end If %> <% if Cint(NextQuestion) <= 10 then 'if end of quiz, don't risk out of range errors 'Get numer of photograph for this question PicNumber = GetPictureNo(QuestionString, NextQuestion) 'get picture URL ImagePath = GetPictureURL(PicNumber) end if 'end of question below 10 check %> <% 'determine body and form types If Cint(NextQuestion) > 10 Then FormName = "SARG_Quiz_Results.asp" BodyScript = " onload=" & Chr(34) & "document.myform.submit()" & Chr(34) Else FormName = "SARG2_Quiz_Questions_Buttons2.asp" BodyScript = "" End If %>
Question: <%=NextQuestion%> of 10