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

Q4. Given the following HTML form code, Write Ex2.php that displays all the inpu

ID: 3686322 • Letter: Q

Question

Q4. Given the following HTML form code, Write Ex2.php that displays all the input of the user (2 Marks)
<html>
<head>
<title>Personal INFO</title>
</head>
<body>
<form method="post" action="Ex2.php">
First Name:<input type="text" size="12" maxlength="12" name="Fname"><br />
Last Name:<input type="text" size="12" maxlength="36" name="Lname"><br />
Gender:<br />
Male:<input type="radio" value="Male" name="gender"><br />
Female:<input type="radio" value="Female" name="gender"><br />
Please choose type of residence:<br />
Steak:<input type="checkbox" value="Steak" name="food[]"><br />
Pizza:<input type="checkbox" value="Pizza" name="food[]"><br />
Chicken:<input type="checkbox" value="Chicken" name="food[]"><br />
<textarea rows="5" cols="20" name="quote" wrap="physical">Enter your favorite quote!</textarea><br />
Select a Level of Education:<br />
<select name="education">
<option value="Jr.High">Jr.High</option>
<option value="HighSchool">HighSchool</option>
<option value="College">College</option></select><br />
Select your favorite time of day:<br />
<select name="TofD" size="3">
<option value="Morning">Morning</option>
<option value="Day">Day</option>
<option value="Night">Night</option></select><br />
<input type="submit" value="submit" name="submit">
</form>
</body>
</html>

Explanation / Answer

<html>

<head>

<title>Personal INFO</title>

</head>

<body>

Firstname <?php echo $_POST ["Fname"] ; ?><br>

Lastname <?php echo $_POST ["Lname"] ; ?>

Gender <?php echo $_POST["gender"] ; ?>

type of residence: <?php echo $_POST ["food [ ] "]; ?>

favorite quote <?php echo $_POST ["quote"] ; ?>

level of Education <?php echo $_POST["education"] ; ?>

favorite time of day<?php echo $_POST ["TofD"] ; ?>

</body>

</html>