title: PHP Form Validation with isset() function
body: <p>Code from Robin Nixon book:</p>
  
  <pre><code>&lt;?php
  if (isset($_POST['name'])) $name = $_POST['name'];
  else $name = '(enter your name)';
  echo &lt;&lt;&lt;_END
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Test&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
      Your name is $name&lt;br /&gt;
      &lt;form method = 'post' action = 'count.php'&gt;
          What's your name?
          &lt;input type='text' name='name' /&gt;
          &lt;input type='submit' /&gt;
      &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  _END
  ?&gt;
  </code></pre>
  
  <p>In the second line we check is variable set or not with <code>isset()</code>. In the third line we have a condition: if it's not set, the script prints 'enter your name'. That's what I do not understand: I open this page - it prints:</p>
  
  <blockquote>
    <p>Your name (Enter your name) What is your name? (and the submission form)</p>
  </blockquote>
  
  <p>Did not enter nothing at all, then hit "send" - it prints:</p>
  
  <blockquote>
    <p>Your name is (and does NOT print "Enter your name") What's your name? (and the submission form)</p>
  </blockquote>
  
  <p>I didn't enter anything but the function said that the variable was set to a value other than <code>NULL</code>. Why? If it passes an empty value, then why use it? Why just not use <code>empty</code>? But in all programs I see solution like this. Why do we have to use <code>isset()</code> function there?  What don't I understand?</p>