Update the following PHP script to check the users answer to this quiz. The answer key is provided as part of the HTML and the weight of each question is also given. When the user submits the quiz provide them a report of how they did. Include points they got right, percentage score, and letter grade. Add feedback in mon-day-year hh24:mi
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta charset="UTF-8">
<title>Great Explorers Quiz</title>
</head>
<body>
<?php
// put your code here
$points_possible = 36;
$points_correct = 0;
$letter_grade = '';
$score_percent = 0;
$feedback= date('M-d-Y-H:i');
if (isset($_POST['grade'])) {
$question1 = $_POST['question1'];
$question2 = $_POST['question2'];
$question3 = $_POST['question3'];
$question4 = $_POST['question4'];
$question5 = $_POST['question5'];
// check each answer and add points for correct ones
if ($question1 === 'd') {
$points_correct += 5;
}
if ($question2 === 'b') {
$points_correct += 5;
}
if ($question3 === 'a') {
$points_correct += 8;
}
if ($question4 === 'b') {
$points_correct += 8;
}
if ($question5 === 'c') {
$points_correct += 10;
}
// calculate the score percent and letter grade
$score_percent = round($points_correct / $points_possible * 100);
switch (true) {
case $score_percent >= 90:
$letter_grade = 'A';
break;
case $score_percent >= 80:
$letter_grade = 'B';
break;
case $score_percent >= 70:
$letter_grade = 'C';
break;
case $score_percent >= 60:
$letter_grade = 'D';
break;
default:
$letter_grade = 'F';
}
} // provide feedback on submission
?>
<h1>Great Explorers Quiz</h1>
<p>Answer all of the questions on the quiz, then select the Score button to grade the quiz.</p>
<?php
//Display this quiz FORM only if they have not submitted answers
echo '
<form action="explorequiz.php" method="post">
<p><b>1. In what year did Sir Edmun Hillary and Tenzing Norgay become the first climbers to reach the summit of Mt. Everest?</b></p>
<p><input type="radio" name="question1" value="a" /> 1927<br />
<input type="radio" name="question1" value="b" /> 1936<br />
<input type="radio" name="question1" value="c" /> 1949<br />
<input type="radio" name="question1" value="d" /> 1953<br /> </p><!-- correct answer 5 points-->
<p><b>2. Which desert did David Livingston cross to reach Lake Ngami?</b></p>
<p><input type="radio" name="question2" value="a" /> Gobi<br />
<input type="radio" name="question2" value="b" /> Kalahari<br /> <!-- correct answer 5 points -->
<input type="radio" name="question2" value="c" /> Sahara<br />
<input type="radio" name="question2" value="d" /> Negev<br /></p>
<p><b>3. What African-American explorer reached the North Pole with Robert Peary in 1909?</b></p>
<p><input type="radio" name="question3" value="a" /> Matthew Henson<br />
<input type="radio" name="question3" value="b" /> Jim Beckwourth<br /> <!-- correct answer 8 points -->
<input type="radio" name="question3" value="c" /> Jesse Owens<br />
<input type="radio" name="question3" value="d" /> Booker T. Washington<br /> </p>
<p><b>4. What was the name of Jacques Cousteau\'s research vessel?</b></p>
<p><input type="radio" name="question4" value="a" /> Sea Witch<br />
<input type="radio" name="question4" value="b" /> Calypso<br /> <!-- correct answer 8 points -->
<input type="radio" name="question4" value="c" /> New Frontier<br />
<input type="radio" name="question4" value="d" /> Avignon<br /> </p>
<p><b>5. Who was the first European to explore Florida?</b></p>
<p><input type="radio" name="question5" value="a" /> Hernando De Soto<br />
<input type="radio" name="question5" value="b" /> Sir Francis Drake<br />
<input type="radio" name="question5" value="c" /> Ponce De Leon<br /><!-- correct answer 10 points -->
<input type="radio" name="question5" value="d" /> James Cook<br /> </p>
<p><input type = "submit" value = "Grade Quiz" name="grade"/></p>
</form>';
?>
</body>
</html>
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps
- What is the correct DOM method to update the src attribute value of the HTML img element. Please select one of the following: setAttribute() textContent src() getAttribute()arrow_forwardYou have been given the sales receipt (see the file sales_receipt.pdf in the extra folder) created using Google Sheets. Your task is to build this receipt using an HTML table. Ignore the formatting; such as the thin border, text alignment (center and right) and column widths - you just need to build a basic HTML table. Qty 4 Aluminum 6 Glass 6 Brass 4 Vinyl 6 Wood 5 Stone Sales Tax Total Use HTML Sales Receipt Description Unit Price Total Cost $3.09 $12.36 $1.42 $8.52 $2.24 $13.44 $2.29 $9.16 $2.52 $15.12 $2.57 $12.85 8% $5.72 $77.17arrow_forwardYou have been given the sales receipt (see the file sales_receipt.pdf in the extra folder) created using Google Sheets. Your task is to build this receipt using an HTML table. Ignore the formatting; such as the thin border, text alignment (center and right) and column widths - you just need to build a basic HTML table. Qty 4 Aluminum 6 Glass 6 Brass 4 Vinyl 6 Wood 5 Stone Sales Tax Total Use HTML Sales Receipt Description Unit Price Total Cost $3.09 $12.36 $1.42 $8.52 $2.24 $13.44 $2.29 $9.16 $2.52 $15.12 $2.57 $12.85 8% $5.72 $77.17arrow_forward
- I need help with creatufb this HTML. Thank you. Create an HTML form that has one input text field for your Fahrenheit degrees Add a hidden field to the form, use this field to indicate the form is submitted Add a submit button to the form Make sure the form posts to the same file in the "action" Add the PHP code for: On load, populate the input text field with some default degree value, like 87 On Submit, or POST, read the input field value submitted and convert the value to a Celcius degree Use the standard formula (X°F − 32) × 5/9 = Y°C (where 5/9 = 0.5556) Display the resulting Celcius degrees Y°C in the page after you calculate the result, along with the rest of the form, so you can submit again another valuearrow_forwardCreate the following table with cell padding and spacing 25 and border 1 and border color blue: Note: HTML only D EX14 C G Ⓒ File | C:/Users/AlMaatooq/Desktop/J120%20%/course%20code/Exercise % 2014.html G Google # Locations coordinates 29.3334455 27.1234567 33.1234123 Type here to search 32.4321876 t n Al Q EN 3 ↓ ENG 0 11:23 PM 9/7/2022arrow_forwardMake up a table of data. Your table must have at least four rows and four columns. It must have at least one rowspan and one colspan attribute. The value for these attributes must be greater than 1. You can make up your own data. However, the table does have to make sense. Please name this file part one.html,arrow_forward
- Please fix the main.js file so that when the button is clicked enough times the <button class="hot-button cold"> in index.html gets changed to <button class="hot-button cool"> at less than 4 clicks, <button class="hot-button tepid"> at less than 7 clicks and so forth. We only just learned dom manipulation and document.querySelector() pls help me understand dom better thank you very much! index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>DOM Manipulation</title> <link rel="stylesheet" href="styles.css"> </head> <body> <main> <button class="hot-button cold">Hot Button</button> <p class="click-count">Clicks: 0</p> </main> <script src="main.js"></script> </body> </html> main.js var $hot =…arrow_forwardWrite the whole HTML page from the DOCTYPE declaration to the closing HTML tag and code a web form that include the following requirements: Three inputs: First name, Last name, Email with appropriate labels and placeholder text; A drop-down list containing the following options: Student, Faculty; Two radio buttons containing the following options: Full-time, Part-time; Controls labeled "Send Registration" and "Clear All Fields". When the Send Registration control is clicked on, the user input will be sent to https://learndigital.dev/DGL103/dgl103-form.php for processing. When Clear All Fields is clicked, any data that was entered into the form is cleared. Make sure that all the data is sent securely. Add internal CSS (and extra HTML if you need to) so that your page looks like the image below. DON'T include more CSS than you need to: The form is 400px wide; The form is centred on the page and has a top margin of 40px; The text, email and select type inputs take up 100% of their…arrow_forwardCreate a class timetable table in HTML. The columns should provide class times, and the rows should include days of the week. Subject and instructor should be in the table data. The table's top caption should be suitable.arrow_forward
- Event Listeners Go to the co_credit.js file in your editor. Create an event listener for the window load event that retrieves the field values attached to the query string of the page’s URL. Add the following to the event listener’s anonymous function: Create the orderData variable that stores the query string text from the URL. Slice the orderData text string to remove the first ? character, replace every occurrence of the + character with a blank space, and decode the URI-encoded characters. Split the orderData variable at every occurrence of a & or = character and store the substrings in the orderFields array variable. Write the following values from the orderFields array into the indicated fields of the order form: orderFields[3] into the modelName field orderFields[5] into the modelQty field orderFields[7] into the orderCost field orderFields[9] into the shippingType field orderFields[13] into the shippingCost field orderFields[15] into the subTotal field orderFields[17]…arrow_forwardso which option is correct from this There should not be a >bracket at the end. The language attribute name in the <html> tag should not be lang. There should not be a <body> tag There should be quote marks around the content ID in the second <div> tag.arrow_forwardWhat is wrong with the following HTML code? This is the first list item. This is the second list item. This is the third list item. а. The "id" properties must be unique in an HTML document. O b. More than one "li" element are not allowed in an unordered list. О с. All three list item elements must have a class attribute.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education