Sounds to me you want to group the results..
the attachment hasn't come through so I'm guessing here that a person can only be in one dorm.. so if everyone is in a database you can just order or group by the dorm..
ie.
PHP Code:
table persons
- id
- name
- dorm
$sql = 'select id, name, dorm from persons order by dorm asc, name asc';
$result = mysql_query($sql); // I'm assuming you already have a db connection
$dorm = '';
while($row = Mysql_fetch_array($result))
{
if ($dorm != $row['dorm'])
{
echo $dorm.'<br/><hr/>';
$dorm = $row['dorm'];
}
echo '<input type=checkbox name="person[]" value="'.$row['id'].'" checked />'.$row['name'].'<br/>';
}
that would be a quick list of checkboxes..
Hope it helps..
Peanuts
Bookmarks