title: PHP POST array with empty and isset
body: <p>I have the following multiple checkbox selection:</p>
  
  <pre><code>&lt;input type="checkbox" name="fruit_list[]" value="apple"&gt;Apple
  &lt;input type="checkbox" name="fruit_list[]" value="banana"&gt;Banana
  &lt;input type="checkbox" name="fruit_list[]" value="mango"&gt;Mango
  &lt;input type="checkbox" name="fruit_list[]" value="orange"&gt;Orange
  </code></pre>
  
  <p>form connects to <code>processor.php</code> via POST method. Validation:</p>
  
  <pre><code>if ( empty($_POST['fruit_list']) ){
      echo "You must select at least one fruit.&lt;br&gt;"; 
  } else{
      foreach ( $_POST['fruit_list'] as $frname ){
          echo "Favourite fruit: $frname&lt;br&gt;";
      }
  }
  </code></pre>
  
  <p>My Questions (above code works! But unclear points for me): </p>
  
  <ol>
  <li><p>If I don't select any of checkboxes and then submit form, does <code>$_POST</code> array contain an index called <code>$_POST['fruit_list']</code> ?</p></li>
  <li><p>Assuming your answer "No", then how is it possible to use <code>empty()</code> to that non existed array element? Non-existed array element means <code>NULL</code> ?</p></li>
  <li><p>What is the difference using <code>!isset($_POST['fruit_list'])</code> instead of <code>empty()</code></p></li>
  </ol>
  
  <p>I understand the difference between <code>empty()</code> and <code>isset()</code> generally. </p>
  
  <p>Can you explain in this context of example?</p>