I was given the following code by the great JPADIE. It loads column names in an array then displays a checkbox and column name on the form for each occurance. I would like to add a 'reset' button that will remove any check in a box and redisplay the column names and empty boxes. As always, thanks in advance for your help.
$result = mysql_query("Show fields from e107_act_emps") or die (mysql_error());
$checkboxes = "";
while ($row = mysql_fetch_assoc($result)):
$fields[] = $row['Field'];
endwhile;
foreach ($fields as $field):
if(isset($_SESSION['cb_fields'])):
$checked = in_array($field, $_SESSION['cb_fields']) ? "checked" : "";
else:
$checked="";
endif;
$checkboxes .= <<<EOF
<span class="wrapper" style="float:left;width:14em;">
<span class="cbox" >
<input $checked type="checkbox" name="cb_fields[]" value="$field" />
</span>
<span class="fld" >
$field
</span>
</span>
EOF;
endforeach;
$result = mysql_query("Show fields from e107_act_emps") or die (mysql_error());
$checkboxes = "";
while ($row = mysql_fetch_assoc($result)):
$fields[] = $row['Field'];
endwhile;
foreach ($fields as $field):
if(isset($_SESSION['cb_fields'])):
$checked = in_array($field, $_SESSION['cb_fields']) ? "checked" : "";
else:
$checked="";
endif;
$checkboxes .= <<<EOF
<span class="wrapper" style="float:left;width:14em;">
<span class="cbox" >
<input $checked type="checkbox" name="cb_fields[]" value="$field" />
</span>
<span class="fld" >
$field
</span>
</span>
EOF;
endforeach;