ownForm.php

Source of ownForm.php

<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>ownForm.php</title>
</head>
<body>
<?php
if (filter_has_var(INPUT_POST, "userName")){
  //the form exists - process it
  $userName = filter_input(INPUT_POST, "userName");
  print "<h1>Hi, $userName</h1>\n";
} else {
  //no form present, so give 'em one
  print <<<HERE
  <form action = ""
        method = "post">
    <fieldset>
      <label>Name</label>
      <input type = "text"
             name = "userName">
      <button type = "submit">
        submit
      </button>
    </fieldset>
  </form>
HERE;
} // end if
?>
</body>
</html>