The Question You need to make a trivia game that also allows you to set some pro
ID: 3658535 • Letter: T
Question
The Question You need to make a trivia game that also allows you to set some properties for the page and have these "remembered." trivia.php trivia.php will display a trivia question and provide a form with a textbox for the user to type their guess at the answer. The form will submit back to itself (trivia.php). You will load your trivia questions from the provided QUESTIONS.TXT file. Please note that there is one question and answer per line. These are separated by a character. Your program needs to allow for any number of questions in QUESTIONS.TXT. You will start by displaying the first question to the user, and after they give a non-empty response, move on to the second question, and so-forth. Provide a progress indicator to the user. For example: Question 6/8. When the user has completed all the questions, display a table for the results. Each row of the table will contain the question number, the question text, the correct answer, and the answer the user typed. If the user got it correct, change the background-color of row to light green, else change the background color to light red. Display the percentage of answers they got correctly. At any time the user can restart the game by clicking a hyperlink labeled Restart. This will bring them back to the first question, and 0 their scores. At any point the user should be able to change the background color of the web page and the foreground color of the text using a drop down list. I would like to see a high-contrast option for the visually impaired. Use a cookie for this, and keep this indefinitely, until the user clears their cache.Explanation / Answer
handler.php
question.xml
question.xsl
<html>
<head>
<title>Total marks</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<?php
//print_r($_POST);
$loop_counter = count($_POST)/2 +1;
$marks=0; $wrong =0;
for ($i=1;$i<$loop_counter;$i++)
{
if($_POST['qon'.$i]==$_POST['cor'.$i]) $marks++;
}
echo "You Obtained : ".$marks."<br>";
?>
<body>
</body>
</html>
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.