Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

feedback.html <!doctype html> <html lang=\"en\"> <head> <meta charset=\"utf-8\">

ID: 3910729 • Letter: F

Question

feedback.html

<!doctype html>
<html lang="en">
<head>
   <meta charset="utf-8">
   <title>Feedback Form</title>
</head>
<body>
<!-- Script 3.1 - feedback.html -->
<div><p>Please complete this form to submit your feedback:</p>

<form action="handle_form.php">

   <p>Name: <select name="title" required>
   <option value="Mr.">Mr.</option>
   <option value="Mrs.">Mrs.</option>
   <option value="Ms.">Ms.</option>
   </select> <input type="text" name="name" size="20" required></p>

   <p>Email Address: <input type="email" name="email" size="20" required></p>

   <p>Response: This is...  
   <input type="radio" name="response" value="excellent" required> excellent
   <input type="radio" name="response" value="okay"> okay
   <input type="radio" name="response" value="boring"> boring</p>

   <p>Comments: <textarea name="comments" rows="3" cols="30" required></textarea></p>

   <input type="submit" name="submit" value="Send My Feedback">

</form>
</div>
</body>
</html>

handle_form.php

<!doctype html>
<html lang="en">
<head>
   <meta charset="utf-8">
   <title>Your Feedback</title>
</head>
<body>
<?php // Script 3.3 handle_form.php
// This page receives the data from feedback.html.
// It will receive: title, name, email, response, comments, and submit in $_POST.
// Create shorthand versions of the variables:
$title = $_POST['title'];
$name = $_POST['name'];
$response = $_POST['response'];
$comments = $_POST['comments'];
// Print the received data:
print "<p>Thank you, $title $name, for your comments.</p>
<p>You stated that you found this example to be '$response' and added:<br>$comments</p>";
?>
</body>
</html>

I from Chapter 3 in your Web browser without going through a URL (i.e. the address bar would likely start with file://). Fill out and submit the form. Write your observation about the result and what caused this result. Also, introduce the following errors into a PHP script: improperly balancing quotation marks, failing to use semi-colons, and referring to variables improperly. Note the problem that you introduced and the resulting error. Submit your write up in a Word document.

Explanation / Answer

If you have any doubts, please give me comment...

feedback.html

<!doctype html>
<html lang="en">
<head>
   <meta charset="utf-8">
   <title>Feedback Form</title>
</head>
<body>
<!-- Script 3.1 - feedback.html -->
<div><p>Please complete this form to submit your feedback:</p>

<form action="handle_form.php" method="POST">

   <p>Name: <select name="title" required>
   <option value="Mr.">Mr.</option>
   <option value="Mrs.">Mrs.</option>
   <option value="Ms.">Ms.</option>
   </select> <input type="text" name="name" size="20" required></p>

   <p>Email Address: <input type="email" name="email" size="20" required></p>

   <p>Response: This is...  
   <input type="radio" name="response" value="excellent" required> excellent
   <input type="radio" name="response" value="okay"> okay
   <input type="radio" name="response" value="boring"> boring</p>

   <p>Comments: <textarea name="comments" rows="3" cols="30" required></textarea></p>

   <input type="submit" name="submit" value="Send My Feedback">

</form>
</div>
</body>
</html>

handle_form.php

<!doctype html>
<html lang="en">
<head>
   <meta charset="utf-8">
   <title>Your Feedback</title>
</head>
<body>
<?php // Script 3.3 handle_form.php
// This page receives the data from feedback.html.
// It will receive: title, name, email, response, comments, and submit in $_POST.
// Create shorthand versions of the variables:
$title = $_POST['title'];
$name = $_POST['name'];
$response = $_POST['response'];
$comments = $_POST['comments'];
// Print the received data:
print "<p>Thank you, $title $name, for your comments.</p>
<p>You stated that you found this example to be $response and added:<br>$comments</p>";
?>
</body>
</html>