title: Dynamically display data from csv file into drop down list
body: <p>I have a csv file that contains a bunch of states in one column of its table. I need to take those states and populate a drop down list with them <em>with no repeats</em></p>
  
  <p>My code for this is</p>
  
  <pre><code>//make unique array
  for ($i=0; $i&lt;count($array); $i++)
   {
   $state_array[$i]=$array[$i][1];
   }
  
  //display in drop down list
  $state_array=array_unique($state_array); 
  $state_array=array_values($state_array); 
  
  for ($i=0; $i&lt;count($state_array); $i++)
      {
      echo "&lt;option value='".$state_array[$i]."'&gt;".$state_array[$i]."&lt;/option&gt;";
      }
  
  ?&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>The csv file is outputted to a multidimensional array and the index for the states is $array[$i][1]</p>
  
  <p>There's something wrong with my code as the select box remains blank. Can anyone spot what's wrong please? Any help is appreciated.</p>
  
  <p><strong>Note:</strong> If it counts, I'll just mention that I can't use SQL, Java, etcetc. Only php.</p>