Processing Form Code

This example is the full source code from my tutorial on How do I process the information from a form

<html>
 
<head>
<title>Sample Forms</title>
<meta name="author" content="Brent Knigge">
</head>
 
<body>
 
<?php
if(isset($_POST['submit']))
  {
  echo '<p>Thank-you.  Breakfast will be ready soon!</p>';
 
  //-----
  //--Processing the Text Input Field
  //-----
  if(empty($_POST['roomnumber']))
    echo '<p>Breakfast will be available from the dining room</p>';
  else
    echo "<p>Breakfast will be delivered to room {$_POST['roomnumber']}</p>";
 
  /*Technique 2 - using strlen*/
  //if(strlen($_POST['roomnumber']) == 0)
  //  echo '<p>STRLENBreakfast will be available from the dining room</p>';
  //else
  //  echo "<p>STRLENBreakfast will be delivered to room {$_POST['roomnumber']}</p>";
  //-----
 
  //-----
  //--Processing the Radio Buttons
  //-----
  if(isset($_POST['gender']))
    {
    switch($_POST['gender'])
      {
	  case 'M':
	    echo '<p>Good Morning Mr</p>';
	  break;
 
	  case 'F':
	    echo '<p>Good Morning Miss</p>';
	  break;
 
	  case 'N':
 
      default:
	    echo '<p>Good Morning</p>';
	  break;
	  }
    }
  //-----
 
  //-----
  //--Processing the Checkboxes
  //-----
  $sentence = 'You are having ';
  $s_end = FALSE;
 
  if(isset($_POST['Toast']))
	$sentence .= 'Toast, ';
 
  if(isset($_POST['Cereal']))
	$sentence .= 'Cereal, ';
 
  if(isset($_POST['Bacon_Eggs']))
	{
	$s_end = TRUE;
	$sentence .= 'Bacon and Eggs';
    }
 
  if(!$s_end)
    $sentence = substr($sentence, 0, strlen($sentence) - 2);
 
  if($sentence <> 'You are havin')
    echo '<p>' . $sentence . '.</p>';
  //-----
 
  //-----
  //--Processing the listbox
  //-----
  $breaky_array = array(1 => 'Small Size', 'Normal Size', 'King Size');
  if(isset($_POST['breakfastSize']) && !empty($_POST['breakfastSize']))
    echo '<p>You are having a ' . $breaky_array[$_POST['breakfastSize']] . ' breakfast</p>';
  //-----
  }
else
  {
?>
<h2>Sample demonstration of Forms Processing</h2>
<form name="Form1" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<p>Room Number<br />
<input type="text" name="roomnumber" maxlength="60" size="60" /></p>
 
<p>Gender<br />
<input type="radio" name="gender" value="M" />Male &nbsp;
<input type="radio" name="gender" value="F" />Female &nbsp;
<input type="radio" name="gender" value="N" />Not Sure</p>
 
<p>Select type of breakfast you want<br />
<input type="checkbox" name="Cereal" />Cereal &nbsp;
<input type="checkbox" name="Toast" />Toast &nbsp;
<input type="checkbox" name="Bacon_Eggs" />Bacon and Eggs</p>
 
<p>Select the Size of the Breakfast<br />
<select name="breakfastSize" size="1">
  <option value="" selected>Please Select</option>
  <option value="3">King Size</option>
  <option value="2">Normal Size</option>
  <option value="1">Small Size</option>
</select></p>
 
<p><input type="submit" name="submit" value="submit"></p>
</form>
<?php
}
 
?>
</body>
 
</html>