For some reason I'm getting a different result and all of my names are in one column, but my echoed html code is very weird!
Here's the php code:
Code: Select all
<?php
$columns = 5;
$columnsMinusOne = $columns - 1;
$columnMax = ceil($total/$columns);
?>
blah blah
<div align="center">
<table width="740" border="0" cellpadding="0" cellspacing="0">
<tr>
<?php
for ($j = 0; $j < $columns; $j++) {
echo "<td valign=\"top\" align=\"center\"><span class=\"text1\">";
if ($j == $columnMinusOne)
$columnMax = $total - ($columnMax * $columnMinusOne);
for ($i = 0; $i < $columnMax; $i++) {
$counter = ($j * $columnMax) + $i;
echo $cust_firstname[$counter] . " " . $cust_lastname[$counter] . "<br>";
}
echo "</span></td>";
}
?>
</tr>
</table>
</div>$columnMax is the number of names to be displayed in a column
$counter is calculated on the fly and should go from 0 to 17.
Any thoughts?