Devin,
I did a 10 question quiz for a local museum which involved using radio
buttons and automatic advance to the next question.  At the end I summed the
correct answers and gave a score.  I've wanted to shorten the whole thing
and use a mysql table, but...
The following snip should give you a bit of knowledge on how to (or not to)
do an online quiz.
The quiz is located at http://www.museumoflocalhistory.org/pages/quiz.php
Hope this helps,
Hugh

//snip
<html>
<head>

<SCRIPT LANGUAGE="JavaScript">
function go(loc)
 {
 window.location.href = loc;
 }
</script>
</head>
<body>
<?php

if (!isset($quest))
 {
 print "<h3>10 Questions to Challenge<br>your knowledge of Washington
Township</h3>";
 print "<br><h5><b><a href=quiz.php?quest=1>Take the
Quiz!</a></b></h5><br>";
 print "<br><table align=center cellpadding=10><tr><td><img
src=./postcard/pc1.jpg></td></tr></table>";
 }

// question 1
if ($quest=="1")
 {
 if (!isset($ans))
  {
  $var=1;
  print "<form name=form>";
  print "<h3>Question #$var</h3>";
  print "<br>";
  print "<h6>The City of Fremont was formed from the communities of
Centerville, Irvington, Mission San Jose, Niles, and Warm
Springs.</h6><br>";
  print "<input type=\"radio\" name=\"loc\"
onClick=\"go('quiz.php?quest=$quest&ans=1&var=$var&correct=$correct');\">
True<br>";
  print "<input type=\"radio\" name=\"loc\"
onClick=\"go('quiz.php?quest=$quest&ans=0&var=$var&correct=$correct');\">
False<br>";
  print "</form>";
  print "<br><table align=center cellpadding=10><tr><td><img
src=./postcard/pc2.jpg></td></tr></table>";
  }
 if (isset($ans))
  {
  if ($ans=="1")
   {
   $correct=$correct+1;
   unset($ans);
   print "<h3>You are correct!</h3><br><h4>Fremont was formed by the
incorporation of the 5 towns.</h4>";
   }
  if ($ans=="0")
   {
   $correct=$correct+0;
   unset($ans);
   print "<h3>Sorry, the statement was true.</h3><br><h4>Fremont was formed
by the incorporation of the 5 towns.</h4>";
   }
  print "<br><h5><b><a href=quiz.php?quest=".($var+1)."&correct=$correct>Go
to Question #".($var+1)."</a></b></h5><br>";
  print "<br><table align=center cellpadding=10><tr><td><img
src=./postcard/pc2.jpg></td></tr></table>";
  }
 }
//end snip

----- Original Message -----
From: "Devin Atencio" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 03, 2003 2:47 PM
Subject: [PHP] Create Online Test Program


>
> Dear PHP Users,
>
> I am in the process of trying to create an Online Program that will
> give questions and possible answers then score the test. I was wondering
> if anyone has done this type of thing already and might be able to give
> me some pointers on what the best method of doing this might be?
>
> Devin
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to