Mad Libs!
All fields are requiredCODE FOLLOWS
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Mad Libs</title>
</head>
<body>
<?php include('../includes/header.php')?>
<h1>Mad Libs!</h1>
<form method="GET" action="week-6-my-example.php">
<label for="name1">Name </label><input type="text" id="name1" name="name1"><br><br>
<label for="gender">Gender </label><input type="text" id="gender" name="gender"><br><br>
<label for="verb1">Verb </label><input type="text" id="verb1" name="verb1"><br><br>
<label for="name2">Boy's Name </label><input type="text" id="name2" name="name2"><br><br>
<label for="number">Number </label><input type="text" id="number" name="number"><br><br>
<label for="adjective">Adjective</label><input type="text" id="adjective" name="adjective"><br><br><br>
<input type="submit" value="Submit">
</form>
<?php
$name1 = $_GET['name1'];
$gender = $_GET['gender'];
$verb1 = $_GET['verb1'];
$name2 = $_GET['name2'];
$number = $_GET['number'];
$adjective = $_GET['adjective'];
if ($name1 == "" || $gender == "" || $verb1 == "") {
echo "All fields are required";
} else {
echo $name1 . " was a very lovely " . $gender . ", who really loved to " . $verb1 . ". " . $name1 . " had a brother, named " . $name2 . ". He was " . $number . " years old, and was very " . $adjective . "!";
}
?>
<?php include('../includes/footer.php')?>
</body>
</html>