I can tell you what I did when I needed something you're talking about 🙂
here goes the html source code for checkboxes:
<input type="checkbox" name="fet" value="1">Fet
<input type="checkbox" name="tolt" value="1">Tolt
<input type="checkbox" name="trot" value="1">Trot
<input type="checkbox" name="gallop" value="1">Gallop
<input type="checkbox" name="pass" value="1">Pass
Here goes the validation code:
checkbox($fet, "Cfet", "Fet");
checkbox($tolt, "Ctolt", "Tolt");
checkbox($trot, "Ctrot", "Trot");
checkbox($gallop, "Cgallop", "Gallop");
checkbox($pass, "Cpass", "Pass");
And here goes the function for this:
function checkbox($a, $b, $c) {
if($a == "1") {
echo "<input type=\"checkbox\" name=\"$b\" value=\"1\" checked>$c\n";
} else {
echo "<input type=\"checkbox\" name=\"$b\" value=\"0\">$c\n";
}
}
Now, I don't know if you like this or not but I needed to do it this way 🙂
Hope it helps, Arni