Almost got it working (key word 'almost')
Comparing table of all the different formats to a field in another table to see which were selected in an form for editing.
Displays all the fields in format table.
Displays fine but when the inner while loop finds a match - it checks the box ok but also all the ones after that.
I have put the code for resetting the $chkd variable in every place possible and if I echo it to the screen it's blank but still shows up in the <td> as 'checked'
I know it's something really stupid - I've been looking at it too long.
$format_in = explode(", ", $a_found[format]);
echo "<table><tr>";
$format_query = "select * from rg_format order by format_name";
$format_result = mysql_query($format_query);
$count=1;
while ($a=mysql_fetch_array($format_result)) {
$i=0;
while ($i < sizeof($format_in)){
if (strcmp($format_in[$i],$a[format_name])<0)
$chkd="checked";
$i++;
}//end while $i
echo "
<td>
<input type='checkbox' name='format[]' value='$a[format_name]' $chkd>$a[format_name]
</td>";
$chkd="";
if ($count % 4 == 0)
echo "</tr><tr>";
$count++;
}//end while
echo "</tr></table>