Home › Forums › Archives › Computer Support › Computer Support Discussion › Quiz for website
- This topic has 4 replies, 2 voices, and was last updated 17 years, 4 months ago by bronxy.
-
AuthorPosts
-
December 15, 2006 at 6:42 pm #25815bronxyMember
This website wants a Quiz on their website. Multiple answers per quiz. and when someone picks the wrong answer a little sound byte that we have created will be like HAHA your wrong, and when the correct answer is chosen, it goes YOUR RIGHT or whatever they have it say.
Then @ the end it will caculate the scores. They will see what they got right/wrong. A response as to why they got it wrong, and also the scores will all be emailed to an inbox that only the webmaster can see.
If anyone knows where I can find such a script to upload to this website we are doing, I would appreciate it. I have looked everywhere for one and have had no such luck.
thanks!
December 15, 2006 at 8:03 pm #155424TigerbladeParticipantwell… first it sounds like your quiz is contradicting itself. from the way i read it, it sounds like you want a sound bite to play when someone selects an answer — correct or not — which would basically guide them to the right answer. with instant feedback, they would have to be rather… slow… to not get the right answer for every single question.
which brings me then to the second part… if they’ve basically been given the correct answer to every question, why the need for scoring?
And what sort of script do you need? PHP? ASP? JavaScript?
December 15, 2006 at 9:31 pm #155426bronxyMemberOkay thats true about why do they need the scoring. How about…
If they pick the wrong answer it not only plays a sound of course but they cannot select another answer to try and get it right, that way they dont cheat. Then all of the scores will just be tallied up and they can see what they got along with sending emails to the webmaster.In terms of scripts…
I heard you couldnt send emails via javascript… so I guess whatever else might be easier to setup. Probably would like PHP better, since I dont know much about ASP.the website with the quiz is Johny D & the Morning Crew
click the Johny D. Trivia link. Just in case u wanted to see it.thankss
December 16, 2006 at 12:19 am #155425TigerbladeParticipantwell… i’d think you’ll need javascript to take care of the disabling the other choices. i’m not really familiar with javascript (meaning, i know almost none) but i imagine it’d be something like an onClick function that cycles through whatever other options for that choice were available and disables them.
now, disclaimer, the below code does not actually work. the idea is right, but for some reason it doesnt work and i really dont have any motivation to spend too much time *making* it work.
Code:
function chosen (q,a) {
var question = q;
var answer = a;
for(i=0; i<FormName.question.length; i++)
if(FormName.question.value != answer){
FormName.question.disabled = true;
}
}
document.write(answer);
return;
}to get the form submitted, it’d be something like
Code:<?php$num_questions = 30; //number of questions on your form (assuming you start with q1 and go through q30)
//Set up the body of the email
$body = "Question Answer “;
//Loop through each question
for($i=1;$i<=$num_questions;$i++) {
$body .= "Question $i ” . $_REQUEST[“q$i”] . “ “;
}//End the table of answers
$body .= ““;
//Establish mailing information
$strTo = “[email protected]”;
$strFrom = “[email protected]”; //whatever you want. it’s good practice NOT to send from a user-submitted address.
$strSubject = “Quiz submission”;
$email = $_REQUEST[’email’]; //if your user has to submit their email with the form//Send the email
mail($strTo,$strSubject,$body,”From:$strFromrnReply-to: $emailrnContent-type: text/html; charset=us-ascii”);
?>December 17, 2006 at 7:39 pm #155427bronxyMemberThanks!
I’ll def try out the idea. -
AuthorPosts
- You must be logged in to reply to this topic.