Hello, is it possible to use array in checkbox? Say I have some records in database, and I would like to print a checkbox beside each username. The name of each checkbox will begin with a prefixed var $checkbox_array followed by the $id given respectively.Then once the user submit the form, the script will loop through the array, and check whether every checkbox is set or not. But the script seems doesn't work. In fact I realize that there are couple of problems with the array part since I don't know much about array but I couldn't figure it out anyway. So could anyone please give me a hand on it?Thank you very much.
<?
...
$query="select id,username from memberlist";
$result=mysql_query($query);
print"<form action=$PHP_SELF method=post>";
while(list($id,$username)= mysql_fetch_row($result)){
print"<input type=checkbox name=$checkbox_array[$id]>$username<br>";
}
print"<input type=submit value=submit></form>";
if($submit) {
$total=count($checkbox_array);
for($i=0;$i<$total;$i++) {
if(isset($checkbox_array[$i]))
print"checked";
//do something else
}
}
?>