samedi 2 juillet 2016

Html table filled using php echo and css?


How do I make a empty 5x5 table styled with borders so it looks like a grid, then fill it with the numbers 1-25 using a php loop. This is what I have been able to accomplish so far.

html:

 <table>
  <tr>
    <td></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td></td>
    <td></td>
    <td></td>
  </tr>
</table> 

Php

for($i=1; $i<=25; ++$i) {
        echo $i "<td>";
}

Css

table {
    border-collapse: collapse;
}

table, td {
    border: 1px solid black;
}

Aucun commentaire:

Enregistrer un commentaire