-
-
Save jufemaiz/619e0bc82ee87860a876 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$Fname = $_POST["Fname"]; | |
$Lname = $_POST["Lname"]; | |
$gender = $_POST["gender"]; | |
$food = $_POST["food"]; | |
$quote = $_POST["quote"]; | |
$education = $_POST["education"]; | |
$TofD = $_POST["TofD"]; | |
?> | |
<html> | |
<head> | |
<title>Personal INFO</title> | |
</head> | |
<body> | |
<?php | |
if (!isset($_POST['submit'])) { // if page is not submitted to itself echo the form | |
?> | |
<form method="post" action="<?php echo $PHP_SELF;?>"> | |
<!-- First Name --> | |
<label for="fName">First Name</label> | |
<input type="text" size="12" maxlength="12" name="Fname"><br /> | |
<!-- Last Name --> | |
<label for="lName">Last Name</label><input type="text" size="12" maxlength="36" name="Lname"><br /> | |
<label for="gender">Gender</label> | |
<br /> | |
<label>Male:<input type="radio" value="Male" name="gender"></label> | |
<br /> | |
<label>Female:<input type="radio" value="Female" name="gender"></label> | |
<br /> | |
Please choose type of residence:<br /> | |
<label>Steak:<input type="checkbox" value="Steak" name="food[]"></label> | |
<br /> | |
<label>Pizza:<input type="checkbox" value="Pizza" name="food[]"></label> | |
<br /> | |
<label>Chicken:<input type="checkbox" value="Chicken" name="food[]"></label> | |
<br /> | |
<textarea rows="5" cols="20" name="quote" wrap="physical">Enter your favorite quote!</textarea> | |
<br /> | |
<label for="education">Select a Level of Education:</label> | |
<br /> | |
<select name="education"> | |
<option value="Jr.High">Jr.High</option> | |
<option value="HighSchool">HighSchool</option> | |
<option value="College">College</option> | |
</select> | |
<br /> | |
<label for="TofD">Select your favorite time of day:</label> | |
<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> | |
<?php | |
} else { | |
echo "<p>Hello, ".$Fname." ".$Lname.".</p>"; | |
echo "<p>You are ".$gender.", and you like</p><ul>"; | |
foreach ($food as $f) { | |
echo "<li>".$f."</li>"; | |
} | |
echo "</ul><p><i>".$quote."</i></p>"; | |
echo "<p>You're favorite time is ".$TofD.", and you passed ".$education."!</p>"; | |
} ?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment