-
A Questionnaire for my Site
Hi guys I have been looking for a run through, or a script on this for ages but just dont seem to be getting anywhere.
I want to setup a questionnaire with say 20 questions, each with a multiple choice or Yes/No Answer, and then when you click on finish it will check all your answers and total up your score. It would be good if it put a tick or a cross next to each answer, or something similar so that the person would be able to see if they were right or not.
My Site can support any language, but I myself only know HTML so for any other suggestions you guys will need to write the whole thing so I can copy and paste it
.
Any help at all would be much appreciated.
Thanks
Claks
-
-
Half way there, I think.
Ok I think I found one, but alas it is not working
My stupidity I am sure, so if any of you guys could have a quick look over the scripts I found a suggest what you think could be wrong I would be much obliged.
What happens is I fill out the quiz/questionnaire and then click on submit. At that point from what I can tell, the results page is supposed to come up and tell them how they have done. It just comes up as a blank white page though
I know all the questions and at the moment are stupid, but I just want to get it working then I can edit it to put in real questions
Ok here is the main quiz page, which seems to work ok.
<html>
<head>
<title>My quiz</title>
</head>
<body>
<!-- Begin Cut and Paste -->
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<h1>Aptitute</h1><font face='verdana'><form method='post' action='QuizResult.asp'><br>
<b>Is this Question 1</b><input type='hidden' name='hidCA1' value='2'><br><input type='radio' name='optQ1'value='1'>Yes<br><input type='radio' name='optQ1'value='2'>No<br>
<br><b>Is this Question 1</b><input type='hidden' name='hidCA2' value='2'><br><input type='radio' name='optQ2'value='1'>Yes<br><input type='radio' name='optQ2'value='2'>No<br>
<br><b>Is this Question 1</b><input type='hidden' name='hidCA3' value='2'><br><input type='radio' name='optQ3'value='1'>Yes<br><input type='radio' name='optQ3'value='2'>No<br>
<br><b>Is this Question 1</b><input type='hidden' name='hidCA4' value='2'><br><input type='radio' name='optQ4'value='1'>Yes<br><input type='radio' name='optQ4'value='2'>No<br>
<br><b>Is this Question 1</b><input type='hidden' name='hidCA5' value='2'><br><input type='radio' name='optQ5'value='1'>Yes<br><input type='radio' name='optQ5'value='2'>No<br>
<br><b>Is this Question 1</b><input type='hidden' name='hidCA6' value='2'><br><input type='radio' name='optQ6'value='1'>Yes<br><input type='radio' name='optQ6'value='2'>No<br>
<br><b>Is this Question 1</b><input type='hidden' name='hidCA7' value='2'><br><input type='radio' name='optQ7'value='1'>Yes<br><input type='radio' name='optQ7'value='2'>No<br>
<br><b>Is this Question 1</b><input type='hidden' name='hidCA8' value='2'><br><input type='radio' name='optQ8'value='1'>Yes<br><input type='radio' name='optQ8'value='2'>No<br>
<br><b>Is this Question 1</b><input type='hidden' name='hidCA9' value='2'><br><input type='radio' name='optQ9'value='1'>Yes<br><input type='radio' name='optQ9'value='2'>No<br>
<br><b>Is this Question 1</b><input type='hidden' name='hidCA10' value='2'><br><input type='radio' name='optQ10'value='1'>Yes<br><input type='radio' name='optQ10'value='2'>No<br>
<br><b>Is this Question 1</b><input type='hidden' name='hidCA11' value='2'><br><input type='radio' name='optQ11'value='1'>Yes<br><input type='radio' name='optQ11'value='2'>No<br>
<br><b>Is this Question 1</b><input type='hidden' name='hidCA12' value='2'><br><input type='radio' name='optQ12'value='1'>Yes<br><input type='radio' name='optQ12'value='2'>No<br>
<br><b>Is this Question 1</b><input type='hidden' name='hidCA13' value='2'><br><input type='radio' name='optQ13'value='1'>Yes<br><input type='radio' name='optQ13'value='2'>No<br>
<br><b>Is this Question 1</b><input type='hidden' name='hidCA14' value='2'><br><input type='radio' name='optQ14'value='1'>Yes<br><input type='radio' name='optQ14'value='2'>No<br>
<br><b>Is this Question 1</b><input type='hidden' name='hidCA15' value='2'><br><input type='radio' name='optQ15'value='1'>Yes<br><input type='radio' name='optQ15'value='2'>No<br><input type='hidden' name='hidCount' value='15'><input type='hidden' name='hidCMark' value='1'><input type='hidden' name='hidNMark' value='0'><input type='hidden' name='hidTitle' value='Aptitute'><p><input type='submit' name='cmdSubmit' value='Submit'></p>
</font></p>
<p> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<!-- End Cut and Paste -->
</body>
</html>
And here is the results page.
<html>
<head>
<title>My quiz</title>
</head>
<body>
<!-- Begin Cut and Paste Header
<%@ Language = VBScript %>
<%Option Explicit
response.buffer = true %>
End Cut and paste Header---->
<!-- Begin Cut and Paste Content
<%
'response.clear
'response.expires = 0
Dim strTitle
strTitle = request.form ("hidTitle")
Response.write "<font face='verdana'>"
If request.cookies("styleQuiz") = "Quiz done ! " & strTitle then
Response.write "<font face='verdana'> Sorry you have already attended the Quiz !!</font>"
Else
response.cookies("styleQuiz") = "Quiz done ! " & strTitle
response.cookies("styleQuiz").expires = DateAdd ("d",1,now())
Dim Qnum,intAns,intCMark,intNMark,intQCount,intMark,intCAns,intPercent
intQCount = request.form ("hidCount")
intCMark = request.form ("hidCMark")
intNMark = request.form ("hidNMark")
intMark = 0
for Qnum = 1 to intQCount
intAns = request.form ("OptQ" & Qnum)
intCAns = request.form ("hidCA" & Qnum)
if intAns = intCAns then
intMark = intMark + intCMark
elseif intAns <> "" then
intMark = intMark - intNMark
else
intMark = intMark
end if
next
response.write ("<p align='center'><b><font color='maroon' size=4>Thank you </font></b></p>" & _
"<p align='left'>Thank you for taking the quiz. Here is your result</p>")
intPercent = intMark * 100 / (intQCount * intCMark)
if intPercent >= 80 then
Response.write "<font color='green' size='2'><b>Your Grade : Excellent !! </b></font><br>"
elseif (intPercent > 60) and (intPercent < 80) then
Response.write "<font color='blue' size='2'><b>Your Grade : Good ! </b></font><br>"
elseif (intPercent > 40) and (intPercent < 60)then
Response.write " <font color='navy' size='2'><b>Your Grade : Fair ! </b></font><br>"
else
Response.write "<font color='red'>Your Grade : Poor. </font><br>"
end if
Response.write " Your Score is <font color='#008200'<b>" & intPercent & "%</b></font><br>"
End if
Response.write "</font>"
%>
End Cut and paste Content-->
</body>
</html>
As you have probably guessed, I am rubbish at this, so it is probably a very stupid mistake I have made. I tried putting the header in the head tag but it made no difference still a blank page. I think I followed all the instructions perfectly on the site.
All suggestions welcome 
Thanks
Claks
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks