title: Echo html table from PHP array
body: <p>I'm learning php and I'm stuck with one task.. 
  I have an array looking like this: </p>
  
  <pre><code>$data[1]["First"]   = "Iva";
  $data[1]["Last"]    = "Ivić";
  $data[1]["Date"]    = "2016-09-29";
  $data[1]["Paid"]    = "Yes";
  
  $data[2]["First"]   = "Petar";
  $data[2]["Last"]    = "Perić";
  $data[2]["Date"]    = "2016-02-08";
  $data[2]["Paid"]    = "No";
  
  $data[3]["First"]   = "Tomo";
  $data[3]["Last"]    = "Tomić";
  $data[3]["Date"]    = "2015-08-22";
  $data[3]["Paid"]    = "Yes";
  </code></pre>
  
  <p>I need to echo HTML table from this Array. On the value ['Paid'], html table should output select field and showing current value as selected. 
  Also, first column of the table should assign #ID number.  </p>
  
  <p>So far, I've managed to create the table, but I can't figure out how to count and echo # and getting the select field to work. Second value doesn't work for me.</p>
  
  <pre><code>&lt;table border="1" align="center" width="80%"&gt;
  &lt;tr bgcolor="yellow"&gt;
      &lt;th&gt;ID #&lt;/th&gt;
      &lt;th&gt;First&lt;/th&gt;
      &lt;th&gt;Last&lt;/th&gt;
      &lt;th&gt;Date&lt;/th&gt;
      &lt;th&gt;Paid&lt;/th&gt;
  &lt;/tr&gt;
  &lt;?php 
  
  foreach ( $data as $info )
  {
  // date transform
  $date = explode('-', $info['Date']);
  //var_dump($date); 
  
  echo '&lt;tr align="center" bgcolor="#f6f6f6"&gt;';
  echo ' &lt;td&gt;' '&lt;/td&gt;';// How to count #IDs starting from 1?     
  echo '&lt;td&gt;'. $info['First'] .'&lt;/td&gt;';
  echo '&lt;td&gt;'. $info['Last'] .'&lt;/td&gt;';
  echo '&lt;td&gt;'. $date[2].'.'.$date[1].'.'.$date[0].'.&lt;/td&gt;';
  //echo '&lt;td&gt;'. $info['Paid'] .'&lt;/td&gt;';
  
  echo '&lt;td&gt;';
  echo '&lt;select name="Paid"&gt;';
  echo '&lt;option value="0" selected&gt;'. $info['Paid'] .'&lt;/option&gt;';
  echo '&lt;option value="1"&gt;'. $info['Paid'] .'&lt;/option&gt;';//This is where I'm stuck
  echo '&lt;/select&gt;';
  echo '&lt;/td&gt;';
  echo '&lt;/tr&gt;';
  }
  ?&gt;
  &lt;/table&gt;
  ?&gt;
  </code></pre>
  
  <p>Thanks. </p>