Предполагая, что $ row - это имя столбца сопоставления ассоциативного массива с логическим значением 1 или 0, вы можете сделать что-то вроде этого:
foreach($row as $colname=>$boolean)
{
//create a name for the checkbox which will produce a nice
//PHP array of checked column names in $_POST['col']
$name="col[$colname]";
//create an id for the checkbox
$id='col'.$colname;
//now we output the checkbox - on form submission you will
//see an element in $_POST['col'][$colname] if checked, and
//no element at all if unchecked...
echo '<input type="checkbox" value="1" '.
'name="'.$name.'" id="'.$id.'" '.
($boolean?'checked="checked"':'').
'>';
//output a label - note we'd tied this to the id of the checkbox
//which means you can click the label to tick the box
echo "<label for=\"$id\">colname</label><br/>";
}
Когда форма отправлена, вы получите массив в $ _POST ['col'], проиндексированный по имени столбца, но только для тех полей, которые отмечены, поэтому вы должны установить в false все столбцы, которые не установлены .