Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, I am stuck on figuring out my HTML/PHP homework assignment. The overall goal is to create a 5-question quiz that will automatically be scored,

Hello,

I am stuck on figuring out my HTML/PHP homework assignment. The overall goal is to create a 5-question quiz that will automatically be scored, and record the results of all quiz takers. For each, different part we get to, we need to change the functionality of the program to work with the new data we need to add. For this next part, I need to use PHP to save the quiz results from my already-existing results page to a text file. The new quiz scores should be appended to the text file, so that the old scores are preserved. I need to also save the username, their answers to each question, their overall score, and a timestamp of when the quiz was taken.

Then, after this part is done, I need to use PHP to read the saved quiz results from the text file, and display them on a summary or history page. Results need to be neatly ordered on the page (use CSS or other, structural HTML).

Lastly, on the summary/history page, I need to provide statistics on which questions are the ones that were answered incorrectly the most, and the ones that were answered correctly the most.

And of course, I need to make sure to use indentation and whitespace, as well as comment all of my code. I do not need to do any form validation for this assignment. If a question is left blank, I need to count it as wrong. For the name field, I also need to use HTML required attribute to ensure the user inputs something.

Below is my current HTML code for my 5-question quiz:

Disney Quiz

Are you an avid Disney fan? Let's see!

And below is my current PHP code for scoring the quiz results (results page):

Disney Quiz Results

$radio1_submitted_value=$_GET['radio1name']; $radio2_submitted_value=$_GET['radio2name'];

$dwarf_option = $_GET['dwarfs'];

$quiz_score = 0; if($dropdown1=="drop3"){ echo " You got the correct answer for Question #1! "; $quiz_score += 1; } else{ echo " You got the incorrect answer for Question #1. "; } if($dropdown2=="drop4"){ echo " You got the correct answer for Question #2! "; $quiz_score += 1; } else{ echo " You got the incorrect answer for Question #2. "; }

if (in_array ( "value2", $dwarf_option ) && in_array ( "value4", $dwarf_option ) && in_array ( "value6", $dwarf_option ) && in_array ( "value8", $dwarf_option ) && in_array ( "value9", $dwarf_option ) && in_array ( "value11", $dwarf_option ) && in_array ( "value12", $dwarf_option )) { echo " You got the correct answers for Question #3! "; $quiz_score += 1; } else{ echo " You got the incorrect answer(s) for Question #3. "; }

if($radio1_submitted_value=="option1"){ echo " You got the correct answer for Question #4! "; $quiz_score += 1; } else{ echo " You got the incorrect answer for Question #4. "; } if($radio2_submitted_value=="option4"){ echo " You got the correct answer for Question #5! "; $quiz_score += 1; } else{ echo " You got the incorrect answer for Question #5. "; }

echo "

You scored $quiz_score out of 5 questions correctly!

"; ?>

Thank you so much for your help, in advance!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions