Click to See Complete Forum and Search --> : how do i create a test form


tali96
02-01-2005, 01:30 PM
hello, I am trying to create a test with 20 questions. If you pass the test you will recive a certificate at the end that can be printed out..probably pdf format. and the answers will be emailed to me. If you fail you will never recieve the certificate and will have to take the test over. Any one have any recomendations on how to do this?....I am a newbie to asp

lmf232s
02-01-2005, 01:49 PM
will you be using a database?
Is it just one test? or are there multiple types of tests?
Can all questions appear on one page? or do you need to have like
5 questions per page?

Maybe supply alittle more info on some specifics of the test,
and im sure we will be able to help you come up with a couple
different solutions.

tali96
02-01-2005, 01:53 PM
well there is just one test..and all questions will appear on one page or many pages...It is not required to maintain a database of results that could be tracked by the emails that are recieved.

lmf232s
02-01-2005, 04:50 PM
there are a couple of way you could do this, hidden fields, session
variables, passing variables through the query string using post or
get.

I did a small test w/ 3 questions for you, to give you an idea of
how you might even be able to tackel it with session variables.
Again this is just an idea, and you could do this much more efficient code.


<%
Dim hidsubmit
Dim i
Dim NumCorrect
Dim bScore

hidsubmit = Request.Form("hidsubmit")

Select Case hidsubmit
Case "Grade"
'answer 1
If Request.Form("Q1") = "A" then
Session("1") = True
else
Session("1") = False
end if
'answer 2
if Request.Form("Q2") = "B" then
Session("2") = True
else
Session("2") = False
end if
'answer 3
if Request.Form("Q3") = "D" then
Session("3") = True
else
Session("3") = False
end if
'see how many were correct
NumCorrect = 0
For i = 1 to 3
if Session(i) = True then
NumCorrect = NumCorrect + 1
end if
next

bScore = True

Case Else

end Select%>
<body>
<form name=form method=post>
<input type=hidden name=hidsubmit value="">
<%if bScore = False then 'display the test questions%>
How old are you?<br>
<input type=radio name=Q1 value="A"><font color=red>1</font><br>
<input type=radio name=Q1 value="B">22<br>
<input type=radio name=Q1 value="C">55<br>
<input type=radio name=Q1 value="D">Dead<br>
<br>
Where do you live?<br>
<input type=radio name=Q2 value="A">St.Louis<br>
<input type=radio name=Q2 value="B"><font color=red>Kansas City</font><br>
<input type=radio name=Q2 value="C">Spring Field<br>
<input type=radio name=Q2 value="D">Rolla<br>
<br>
How Much Do You Make?<br>
<input type=radio name=Q3 value="A">1<br>
<input type=radio name=Q3 value="B">10000<br>
<input type=radio name=Q3 value="C">100000<br>
<input type=radio name=Q3 value="D"><font color=red>10000000</font><br>
<br>
<input type=button name=cmdSubmit value="Click Me" onclick="document.form.hidsubmit.value='Grade';document.form.submit();">
<%else 'display the users score%>
Your Answered <%=NumCorrect%> out of 3 correct for a score of <%=FormatPercent(NumCorrect/3, 0)%><br>
<a href="www.MyCertificate.com">Click here to print your certificate</a><br>
<input type=button name=Retake value="Retake Test" onclick="document.form.submit();">
<%end if%>
</form>
</body>

tali96
02-01-2005, 05:09 PM
thanks this looks cool..i put it in my browser and thats kinda what i am looking for. What language is best to use..I was thinking javascript because there is a lot of help out there for that language.

lmf232s
02-01-2005, 09:27 PM
youll most likely use a combination of asp and javascript.