This code does a nice job reading the members from my database and setting up a form with checkboxes for each member in one long single-column list.
What I need to do is to write some sort of loop that sets out 3 or 4 columns and splits the names roughly among them. I know that it involves dividing the number of records by the number of columns and using the modulus, but I've been beating my head against a wall for days now trying to get it to actually work. None of the numerous code samples I've tried seems to work.
Can anyone help me out here?
It should be ordered vertically, not horizontally.
<form name="form1" method="post" action="postoffice-popup.php?action=custom_all_list">
<table style="border:1px solid silver;">
<tr>
<td>
<?php
$result = mysql_query("SELECT id,fname,lname,email FROM members WHERE clubid = '1234' ORDER BY lname,fname");
// loop through the array, creating one row per array
while ($thisrow = mysql_fetch_array($result)) {
// create a variable for each attribute
foreach($thisrow as $var => $value){
$$var = $value;
}
$name = "$lname, $fname";
if ($thisrow["email"]) {
$list = $list." $name <$email>; ";
}
echo " <label for='$id'><input type='checkbox' name='members[]' value='$id' id='$id' /><legend for='$id'>$name</label><br />\n";
}
?>
</td>
</tr>
<tr>
<td>
<input type="submit" name="Submit" value="Submit" style="height:23px;font-weight:bold;padding-top:0px;">
</td>
</tr>
</table>
</form>