Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.144.115.125
Web Server : Apache
System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.2.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/rlbarner/www/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/rlbarner/www/quizformaction.php
<!--
	File Name: quizaction.php
	Date: 12 February 2013
	Author: Regina Barner
	Instructor: Dr. Wang

	Goal: Score the answers to the quiz form and output the 
percentages of the correct answers, and indicate which answers are wrong.
-->

<BODY BGCOLOR="#D9D9F3">
<TITLE>Assignment 2b Quiz Results Page</TITLE>
<FONT FACE="Sylfaen">
<CENTER>
<H2>Quick Quiz Results!</H2>
<HR>

<?php
	$question1 = $_POST['question1'];
	$question2 = $_POST['question2'];
	$question3 = $_POST['question3'];
	$question4 = $_POST['question4'];
	$correctanswer = 0;
	$incorrectanswer = 0;	

	if($question1=="correct")
		$correctanswer = $correctanswer + 1;
        else if($question1=="incorrect")
                $incorrectanswer = $incorrectanswer + 1;
   	else
		print "Error.  Maybe you didn't answer? <BR>";

	if($question2=="correct")
                $correctanswer = $correctanswer + 1;
        else if($question2=="incorrect")
                $incorrectanswer = $incorrectanswer + 1;
	else
		print "Error.  Maybe you didn't answer? <BR>";

	if($question3=="correct")
                $correctanswer = $correctanswer + 1;
        else if($question3=="incorrect")
                $incorrectanswer = $incorrectanswer + 1;
        else
		print "Error.  Maybe you didn't answer? <BR>";

	if($question4=="correct")
                $correctanswer = $correctanswer + 1;
        else if($question4=="incorrect")
                $incorrectanswer = $incorrectanswer + 1;
	else
		print "Error.  Maybe you didn't answer? <BR>";

	print "Out of 4 questions, you got $correctanswer right and $incorrectanswer wrong. <BR>";
	
	$correctpercent = $correctanswer / 4 * 100;
	$incorrectpercent = $incorrectanswer / 4 * 100;
	print "In other words, you got $correctpercent% correct and $incorrectpercent% wrong.<BR>";
?>

<HR>
<A HREF=index.html>Index</A>
</CENTER>
</FONT>
</BODY>

Stv3n404 - 2023