<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>PHP Document</title>
  <style>
    .errors {
      color: #990000;
    }
    div {
      padding: 5px 0px;
    }
  </style>
</head>
<body>
  <?php
    if (!isset($_POST["submit"]) || array_filter($errors)) {
  ?>
  <section>
    <form name="myform" method="post" action="index.php">
      <div>
        <input type="text" name="myname" value="<?php echo htmlspecialchars($name);?>">
      </div>
      <?php
        if ($errors["name"] != "") {
          echo "<div class=\"errors\">".$errors["name"]."</div>";
        }
      ?>
      <div>
        <input type="email" name="myemail" value="<?php echo htmlspecialchars($email);?>">
      </div>
      <?php
        if ($errors["email"] != "") {
          echo "<div class=\"errors\">".$errors["email"]."</div>";
        }
      ?>
      <div><input type="submit" name="submit"></div>
    </form>
  </section>
  <?php
    } else {
  ?>
  <section>
    <div>
      <span>Name: <?php echo htmlspecialchars($name);?></span>
    </div>
    <div>
      <span>Email: <?php echo htmlspecialchars($email);?></span>
    </div>
  </section>
  <?php
    }
  ?>
</body>
</html>