bezierstek
Programmer
Hi,
I have a form that is created dynamically from database entries, and need to know how many have been checked, but am having problems getting the figure.
The checkboxlist is created using this code
and to check it one the form has been submitted I am using this:
The form displays fine and the html that is formed by php seems ok, but I always get 0 for $interestcount.
Can anyone help?
I have a form that is created dynamically from database entries, and need to know how many have been checked, but am having problems getting the figure.
The checkboxlist is created using this code
Code:
<label>
<ul>
<?
$interestsql=mysql_query("select * from interest order by interest");
while ($interestresult = mysql_fetch_array($interestsql)){
?>
<li>
<input name="interestgroup[]" type="checkbox" id="interestgroup[]" value="<? echo $interestresult['intpid'] ?>" />
<? echo $interestresult['interest'];?> </li>
}?>
</ul>
</label>
and to check it one the form has been submitted I am using this:
Code:
$interestcount =count($_POST["interestgroup"]);
echo "interest count= ".$interestcount;
The form displays fine and the html that is formed by php seems ok, but I always get 0 for $interestcount.
Can anyone help?