#!/usr/bin/perl -w use CGI qw(:cgi-lib); #require "cgi-lib.pl"; &ReadParse; $answer2 = $in{'rq2'}; $answer3 = $in{'rq3'}; $answer4 = $in{'rq4'}; $player = $in{'plyrName'}; $beginscore = 40; $numcorrect = 0; $totalquest = 4; @wronganswers = (); if($answer2 eq undef){ &pgeErrTop(); &errmessage(); &pgeErrBottom(); } elsif($answer3 eq undef){ &pgeErrTop(); &errmessage(); &pgeErrBottom(); } elsif($answer4 eq undef){ &pgeErrTop(); &errmessage(); &pgeErrBottom(); } elsif($player eq undef){ &pgeErrTop(); &errmessage(); &pgeErrBottom(); } if($answer2 ne undef && $answer3 ne undef && $answer4 ne undef && $player ne undef) { if($answer2 eq "pun"){ $numcorrect = 1; } elsif($answer2 ne "pun"){ $beginscore = $beginscore - 10; $q1 = "Question 1 from Speech 4"; push(@wronganswers, $q1); } if($answer3 eq "acetyl"){ $numcorrect += 1; } elsif($answer3 ne "acetyl"){ $beginscore = $beginscore - 10; $q2 = "Question 2 from Speech 4"; push(@wronganswers, $q2); } if($answer4 eq "60"){ $numcorrect += 1; } elsif($answer4 ne "60"){ $beginscore = $beginscore - 10; $q3 = "Question 3 from Speech 4"; push(@wronganswers, $q3); } if($beginscore == 40){ &pgeTop(); print "

\n"; print "

Well done $player.

\n"; print "You completed the questions for Speech 4. You gave $numcorrect correct responses out of three questions.\n"; $gameresults = "1948 campaign results for $player for Speech 4. $player gave $numcorrect correct responses out of three questions.\n"; print "

To send a copy of this report to your teacher, please enter:

Name of Class:

Teacher's E-Mail Address:
\n"; &pgeBottom(); } if($beginscore < 40){ &pgeTop(); print "
Hello $player.

\n"; print "You completed the questions for Speech 4. You gave $numcorrect correct response(s) out of three questions. Your responses were incorrect on the following questions:
\n"; print "

\n"; print "To correct your incorrect responses or to review the speech and questions press the BACK button on your browser.

\n"; print "

To send a copy of this report to your teacher, please enter:

Name of Class:

Teacher's E-Mail Address:
\n"; &pgeBottom(); } } sub errmessage { print "

Error

        The question set is incomplete.

Please:

1) Press the back button on your browser to return to the question set 2) Complete any unanswered questions 3) Fill in your name 4) Press the Send button

Thank you.

\n"; } sub pgeErrTop { print "Content-type: text/html\n\n"; print " Results\n"; print "\n"; print "\n"; } sub pgeErrBottom { print "\n"; print "\n"; } sub pgeTop { print "Content-type: text/html\n\n"; print " Results\n"; print "\n"; print "\n"; print "\n"; print "

results

\n"; print "

\n"; } sub pgeBottom { print "\n"; print "\n"; print "\n"; }