Re: [PHP] Online Quizz From: Ignacio Vazquez-Abrams (ignacio <email protected>)
Date: 11/15/00

On Wed, 15 Nov 2000, Bravo, David (CORP, MTC) wrote:

> I'm writing the code for an application to answer Quizzes online.
> It's based on the extras-phpPoll
> I think I'm finishing...
> I need the people can't back to the question once they answered.
> Please help...
> My promise is to post the source code once it's finished...
> thank you
>

Use sessions and do something like this:

Files:
  index.php3 (or whatever)
  q1.inc
  q2.inc
   ...
  bounce.php3 (or whatever)
  mark.php3 (or whatever)

index.php3:
<?php
// Register $qnum
if (!isset($qnum))
  $qnum=1;
include("q$num.inc");
?>
**EOF

q1.inc:
(HTML content goes here)
<form method="post" action="bounce.php3">
(HTML content goes here)
<input type="submit" name="Final Answer!">
(HTML content goes here)
</form>
(HTML content goes here)
**EOF

q2.inc: Similar to q1.inc

bounce.php3:
<?php
// Register $qnum
// Deal with answers here via $HTTP_POST_VARS
$qnum++;
if $qnum>NUMBER_OF_QUESTIONS
  header("Location: mark.php3") // or whatever
else
  header("Location: index.php3") // or whatever
?>
**EOF

mark.php3: Umm...

What happens? It's the same page (index.php3) so the B/F buttons never
become active, and the bounce.php3 makes sure that Navigator doesn't cack
on the fact that it would be the same page posted to otherwise. Plus,
reload doesn't do anything either!

-- 
Ignacio Vazquez-Abrams  <ignacio <email protected>>

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>