If you have this
<input type=checkbox name=sumvar value=1>
and you submit it, without checking the box, no variable will be passed.
There's two ways to deal with checkboxes:
1) Give each checkbox item a unique name (usually sub-elements in a multidimensional array)
2) Have PHP assign unique names in a multidimensional array.
I prefer the former, when all the values will be unique.
TYPE 1 EX:
<INPUT TYPE=CHECKBOX NAME=sumvar[1] VALUE=1>
<INPUT TYPE=CHECKBOX NAME=sumvar[2] VALUE=2>
Use array_keys and a loop to make sure you get all the values passed, as in
ex:
<?
$keys=array_keys($sumvar);
for ($i=0, $i<sizeof($keys); $i++)
{
echo $sumvar[$keys[$i]];
}
?>
TYPE 2 EX:
<INPUT TYPE=CHECKBOX NAME=sumvar[] VALUE=1>
<INPUT TYPE=CHECKBOX NAME=sumvar[] VALUE=2>
<INPUT TYPE=CHECKBOX NAME=sumvar[] VALUE=3>
Will automatically generate an array
sumvar[0].. sumvar[1], etc. starting from the first one pushed on down thru the checkboxes that were checked.
Go ahead and play with this, eh?