How to make multiple errors in PHP when theres no information typed in

I’m trying to make my assignment to look like this when there’s no information typed in but I’m not sure how to do it:

My PHP so far:


	<title>Thank You for Registering!</title>
	<link rel="stylesheet" type="text/css" href="css/KingLib2_.css"/>


 <div id="logo">
	  <img src="KingLibLogo.jpg" alt="King Real Estate Logo"> 
	  <div id="h3">
	  <h3>Thank You for Registering!</h3>
     </div> </h3>

	$firstname = $_POST['firstname']; 
	$lastname = $_POST['lastname']; 
	$email = $_POST['email']; 
	$cityofresidence = $_POST['cityofresidence']; 
	$birthyear = $_POST['birthyear'];
	$current_year = date('Y');
	$age = $current_year - $birthyear;

	print "<p>Name: $firstname $lastname"; 
	print "<p>Email: $email"; 
	print "<p>City: $cityofresidence"; 
	print "<p>Birth Year: $birthyear";
	if ($age > 55) {
		print"<p>Section: Senior</p>";
	if ($age < 54) {
        print"<p>Section: Adult</p>";
	} if ($age < 14 ) {
	    print"<p>Section: Child</p>";



I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.