This works well, but the last 2 cells are missing.
Anyway to dynamically create the missing cells so it looks right ?
<?php
$data = range( '1', '10' );
$numCols = 6;
echo "<table border='1'>\n";
echo "\t<tr>\n";
foreach( $data as $i => $item )
{
if ( $i != 0 && $i++ % $numCols == 0 )
{
echo "\t</tr>\n\t<tr>\n";
}
echo "\t\t<td>$item</td>\n";
}
echo "\t</tr>\n";
echo '</table>';
?>
In this example I've got the numCols =6 but that could change, so the additional cells could be more or less.. Any way to make their back ground color different to the filled in cells ?
Thanks 🙂