title: Multiple drop down form from array in php
body: <p>I'm attempting to make two drop down forms where the information in the second menu changes depending on the what is selected in the first set of options. So far I have two drop down menus but I'm not sure how to make the second dependent to the first. Any help would be much appreciated. I'm using csv files to store my data. This is what I have so far:</p>
  
  <pre><code>&lt;?php
  $filename = ("florida.csv");
  $csvfile = fopen($filename,'rb');
  while(!feof($csvfile)) {
  $csvarray[] = fgetcsv($csvfile);
  } 
  
  print "&lt;select&gt;";
  foreach($csvarray as $row =&gt; $arr) {
  echo '&lt;option value="' . $row . '"&gt;' . $arr[2] . $arr[0] . '&lt;/option&gt;';
  
  }
  print "&lt;/select&gt;";
  
  print "&lt;select&gt;";
  foreach($csvarray as $row =&gt; $arr) {
  echo '&lt;option value="' . $row . '"&gt;' . $arr[1] . '&lt;/option&gt;';
  }
  print"&lt;/select&gt;";
  
  //print_r($csvarray);
  
  ?&gt;
  </code></pre>
  
  <p>This is a sample of what my arrays look like in my csv file.</p>
  
  <pre><code>[0] =&gt; Array
      (
          [0] =&gt; WNDT
          [1] =&gt; 92.5 FM
          [2] =&gt; Alachua
          [3] =&gt; Ocala Broadcasting Corporation, L.L.C.
          [4] =&gt; Classic Rock
          [5] =&gt; Florida
      )
  
  [1] =&gt; Array
      (
          [0] =&gt; WORL
          [1] =&gt; 660 AM
          [2] =&gt; Altamonte Springs
          [3] =&gt; Salem Media of Illinois, LLC
          [4] =&gt; Sports
          [5] =&gt; Florida
      )
  [2] =&gt; Array
      (
          [0] =&gt; WFCT
          [1] =&gt; 105.5 FM
          [2] =&gt; Apalachicola
          [3] =&gt; Williams Communications, Inc.
          [4] =&gt; Adult Standards
          [5] =&gt; Florida
      )
  
  [3] =&gt; Array
      (
          [0] =&gt; WOYS
          [1] =&gt; 100.5 FM
          [2] =&gt; Apalachicola
          [3] =&gt; 3G Broadcasting, Inc.
          [4] =&gt; Classic Hits
          [5] =&gt; Florida
      )
  
  [4] =&gt; Array
      (
          [0] =&gt; WBZW
          [1] =&gt; 1520 AM
          [2] =&gt; Apopka
          [3] =&gt; Pennsylvania Media Associates, Inc.
          [4] =&gt; 
          [5] =&gt; Florida
      )
  
  [5] =&gt; Array
      (
          [0] =&gt; WFLN
          [1] =&gt; 1480 AM
          [2] =&gt; Arcadia
          [3] =&gt; Integrity Radio of Florida LLC
          [4] =&gt; News/Talk
          [5] =&gt; Florida
      )
  </code></pre>