I have table in which rows are retrieved from mysql. I put a checkbox in front of every row. If any row is checked, and a delete button is clicked, I want those checked rows to be removed. In order to remember which rows are checked, I use an array 'checked_row' to keep track it.
if ($myrow = mysql_fetch_array($result))
{
do {
printf("<tr> <td><input type=\"checkbox\" name=\"checked_row[]\" value = \"$title\" > </td> <td>%s</td>
<td>%s</a> </tr>", $title, $edition);
} while ($myrow = mysql_fetch_array($result));
Now I have an additional row in the beginning of the table which holds the name of each column, and if the checkbox in front of this row is checked. I want all rows in the table to be checked. I found some examples about how to implement this in JavaScript, but one problem is that all those examples I found are having the same name for the checkbox in the table rows.
eg: <INPUT TYPE="checkbox" NAME="foo" VALUE="values">something<br>, then in the JavaScript function, they can use a loop to access all foo, but for my case, I can't use a fixed variable since I have to use array to pass values to another page for checked rows and checked_row only gives me errors.
So what can I do in my situation?
Thanks.