When I run this code in HTML, I need it to display an error message for empty fields like in the provided image. Week2 GP1 - Michael Porter Enter your name: Enter your date of birth: Enter your favorite color: Enter your favorite place to visit: Enter your Nickname: 0) echo " The name you entered is: $name "; if (strlen($birth) > 0) echo " The birthdate you entered is: $birth "; if (strlen($color) > 0) echo " You said your favorite color is: $color "; if (strlen($fav_place) > 0) echo " You said your favorite place is: $fav_place "; if (strlen($nickname) > 0) echo " You said your favorite place is: $nickname "; ?>
When I run this code in HTML, I need it to display an error message for empty fields like in the provided image. Week2 GP1 - Michael Porter Enter your name: Enter your date of birth: Enter your favorite color: Enter your favorite place to visit: Enter your Nickname: 0) echo " The name you entered is: $name "; if (strlen($birth) > 0) echo " The birthdate you entered is: $birth "; if (strlen($color) > 0) echo " You said your favorite color is: $color "; if (strlen($fav_place) > 0) echo " You said your favorite place is: $fav_place "; if (strlen($nickname) > 0) echo " You said your favorite place is: $nickname "; ?>
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
When I run this code in HTML, I need it to display an error message for empty fields like in the provided image.
<html>
<head>
<title>Week2 GP1 - Michael Porter</title>
</head>
<body>
<form method='POST'>
<h3>Enter your name: <input type="text" name="name"></h3>
<h3>Enter your date of birth: <input type="text" name="birth"></h3>
<h3>Enter your favorite color: <input type="text" name="color"></h3>
<h3>Enter your favorite place to visit: <input type="text" name="fav_place"></h3>
<h3>Enter your Nickname: <input type="text" name="nickname"></h3>
<input type="submit" value="Submit Values">
</form>
<?php
$name = '';
$birth = '';
$color = '';
$fav_place = '';
$nickname = '';
if (isset($_POST['name']))
$first_name = $_POST['name'];
if (isset($_POST['birth']))
$birth = $_POST['birth'];
if (isset($_POST['color']))
$color = $_POST['color'];
if (isset($_POST['fav_place']))
$fav_place = $_POST['fav_place'];
if (isset($_POST['nickname']))
$nickname = $_POST['nickname'];
if (strlen($name) > 0)
echo "<h3> The name you entered is: $name </h3>";
if (strlen($birth) > 0)
echo "<h3> The birthdate you entered is: $birth </h3>";
if (strlen($color) > 0)
echo "<h3> You said your favorite color is: $color </h3>";
if (strlen($fav_place) > 0)
echo "<h3> You said your favorite place is: $fav_place </h3>";
if (strlen($nickname) > 0)
echo "<h3> You said your favorite place is: $nickname </h3>";
?>
</body>
</html>
![Your Name Wk 2 Performance As X
→ CⒸ localhost/cis224_week2_pa/input_output.php:
Enter your name: |
Enter your birthdate:
Enter your favorite color:
Enter your favorite place to vist:
Enter your nickname:
Submit Values
+
You didn't enter a name!
You didn't enter a birthdate!
You didn't enter a favorite color!
You didn't enter a favorite place!
You didn't enter a nickname!
0 X
4](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F4d27a8a6-cc74-416c-a782-397e5cce3206%2F52337737-ba3d-4b84-afcc-096d55b7f434%2Ff6f3gsi_processed.png&w=3840&q=75)
Transcribed Image Text:Your Name Wk 2 Performance As X
→ CⒸ localhost/cis224_week2_pa/input_output.php:
Enter your name: |
Enter your birthdate:
Enter your favorite color:
Enter your favorite place to vist:
Enter your nickname:
Submit Values
+
You didn't enter a name!
You didn't enter a birthdate!
You didn't enter a favorite color!
You didn't enter a favorite place!
You didn't enter a nickname!
0 X
4
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education