Checkbox Problem

Hi

I am new to PHP and I am facing a problem. I generated a php form from database with 5 checkboxes on each row. I want to get checkbox values for their respective columns but I am getting the values for the whole checkboxes. I used array for these. Is there anyway to sort this out?? Please help me. This is the code.

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” />
<title>Untitled Document</title>
</head>
<body>
<?php
$username=“username”;
$password=“password”;
$database=“adminlogin”;

mysql_connect(“localhost”, “$username”, “$password”);
@mysql_select_db(“$database”) or die( “Unable to select database”);
$query=“SELECT * FROM students”;
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();
?>

?>
<form name=“f1” method=“post” action=“test3.php”>
<table border=“1”>
<tr>
<th>S.No</th>
<th>Student Name</th>
<th>Activity</th>
<th>Fees/day</th>
<th colspan=“5”>Attendance</th>
<th>Paid Fees</th>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td><input type=“hidden” name=“id” id=“id” value=“<? echo $rows[‘id’]; ?>”><? echo $rows[‘id’]; ?></td>
<td><? echo $rows[‘studentname’]; ?></td>
<td><? echo $rows[‘activity’]; ?></td>
<td><input type=“hidden” name=“fees” id=“fees” value=“<? echo $rows[‘fees’]; ?>”><? echo $rows[‘fees’]; ?></td>
<td><input type=“checkbox” name=“find1” value=“<? echo $rows[‘fees’]; ?>”></td>
<td><input type=“checkbox” name=“find2” value=“<? echo $rows[‘fees’]; ?>”></td>
<td><input type=“checkbox” name=“find3” value=“<? echo $rows[‘fees’]; ?>”></td>
<td><input type=“checkbox” name=“find4” value=“<? echo $rows[‘fees’]; ?>”></td>
<td><input type=“checkbox” name=“find5” value=“<? echo $rows[‘fees’]; ?>”></td>

<td><input type=“text” name=“paid” id=“paid”></input></td>
</tr>
<?php
}
?>
</table>
<input type=“submit” name=“submit” value=“Submit”>
</form>
</body>
</html>

What exactly do you mean with this?

Hi Immerse

I am thankful for your interest in this problem. I am preparing a form for attendance. When the checkbox is checked and submitted it must calculate the fees for the attendance for that month and the classes are conducted on all Sundays. For example if the fees is $7/day and if a person comes 3 sundays in a month then the fees is $21. There are 5 checkboxes for each student in a row as there may be 4 or 5 sundays in a month. I used array for checkboxes but it selected all the selected checkboxes in every row. I want to get the attendance individually for each student row. I think now you got the problem. This is the situation. Please help me and ask me if it is not clear.

I think things would be clearer if you post the actual html your php page generates.

But it appears that find1[0] will be the value of the first checkbox in row 1. find1[1] will be the selected value of the first checkbox in row 2 and so on. Bear in mind that the values of only the checked boxes will be sent to your php script.