Forum Moderators: coopster
Someone correct me if I'm wrong, but it sounds as though you are trying to use a table in lieu of a form.
You may find it easier and more in keeping with standards if you use a form..
The HTML table model allows authors to arrange data -- text, preformatted text, images, links, forms, form fields, other tables, etc. -- into rows and columns of cells.
Tables should not be used purely as a means to layout document content as this may present problems when rendering to non-visual media.
$options = Array (
'key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3',
'key4' => 'value4'
// etc
);
<?php
foreach ($options as $key => $value) {
echo "<td><input type=\"checkbox\" name=\"$key\" id=\"$key\" value="$value\"";
// Checkbox values don't have to match. They will be in post or they won't
if (isset($_POST[$key])) { echo ' checked'; }
// or checked="checked" for XHTML
echo "> <label for=\"$key\">$value</label></td>\n";
}
?>
</tr>
<!-- continue as above, with colspan="$colspan" -->