title: Multi-select to Array
body: <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;My Form&lt;/title&gt;
          &lt;meta charset="UTF-8" /&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form method="get"&gt;
              &lt;div&gt;Name 
                  &lt;input name="name" size="15" type="text" /&gt;
              &lt;/div&gt;
              &lt;select multiple="yes" name="colors[]"&gt;
                  &lt;option&gt; 1 &lt;/option&gt;
                  &lt;option&gt; 2 &lt;/option&gt;
                  &lt;option&gt; 3 &lt;/option&gt;
                  &lt;option&gt; 4 &lt;/option&gt;
                  &lt;option&gt; 5 &lt;/option&gt;
              &lt;/select&gt;
          &lt;/form&gt;
          &lt;?php
              $number=10;
              echo "hello";
              if (isset($_GET["name"])){
                  echo " ".$_GET["name"];
                  echo "&lt;br /&gt;";
              }
              echo count($_GET["colors"]), " ", $_GET["colors"], "&lt;br /&gt;";
              echo $_GET[$colors[0]]," is your first color.";
              if(isset($_GET["$colors"])){
                  echo "You must like ";
                  for($colornum=0;$colornum&lt;count($_GET["$colors"]);$colornum++){
                      echo $_GET[$colors[$colornum]]," ";
                  }
              }
          ?&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Why doesn't this work? The select multiple doesn't output right in the array, or possible 
  Has a lot of debugging stuff that doesn't help my understanding much. I get undefined index and variable errors. Here's my output after selecting options 1-3:</p>
  
  <pre><code>Name
  hello jimbo1qaz
  3 Array
  
  Notice: Undefined variable: colors in E:\xampp\htdocs\myform.php on line 28
  
  Notice: Undefined index: in E:\xampp\htdocs\myform.php on line 28 is your first color.
  Notice: Undefined variable: colors in E:\xampp\htdocs\myform.php on line 29
  </code></pre>