Wait A Minute, Mr POSTman

This page does the same job as the one using the GET method. The difference here is that the information is not shown in the URL. This is the more normal way of getting data from a form and much more useful if you don't want the information to be visible in the URL or if the amount of information makes for long URLs.

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php
if (isset($_POST['name']))
{
   $thename= $_POST['name'];
   echo "<h1>Hello ".$thename."</h1>";
}
else
{
   echo "<form action='post.php' method='POST'>
   <p>Enter your name: <input type='text' name='name' size='50'><br>
   <input type='reset' value='Clear'>&nbsp;<input type='submit' value='Submit'>
   </p></form>";
}
?>
</body>
</html>

To work out whether the page has been submitted, we just need to check if any one of the POST variables have been set. If a text field is left blank, pressing submit still sends an empty value to the next page.