Im having a list of student names in a table , in the same table each student name has a check-box , the user will have to check the check-box to add this students in the course , so I want to save the students ID of those who have checked check-box , but it seems that I got nothing in the array !
here is the code
echo "<form action='S7.php' method='post'> <table width='40%' border='1' cellpadding='5'>
<tr>
<td>Check to add to course</td>
<td>Student ID</td>
<td>Student Name</td>
</tr> ";
while ($row = mysql_fetch_assoc($query)){
echo '
<tr>
<td> <input type="checkbox" name="foo['.$row['St_ID'].']" value=""> </td>
<td>'.$row['St_ID'].'</td>
<td>' .$row[First].' ' .$row[Last].'</td>
</tr>';
};
echo "</table>";
echo ' <input type="submit" name="submit" value="Add To Course" /> </form> ';
The input must be like this:
All the checkbox must have the same name, the value is different.