Check all box
Posted: Mon May 19, 2003 4:30 pm
I am creating a table with values, each value has a check box next to it. I would like to add a box at the top that says check all so when it is checked all the boxes get checked. I tried a javascript to do this. When I did that it would check all of the boxes but did not throw these into my array (attendee_id[] ) instead it just passed in the last value(record) instead of all of them. When I manually check them all it works fine. Can anyone help me with this? I am stuck
.... Thank you so much for your time.
mod_edit: php tags added
mod_edit: php tags added
Code: Select all
echo "<table class=listing width=100%>\n";
echo "<tr>\n";
// this is the box I created to select all from
echo " <th>Selected<br><input name=select_all type="checkbox" </th>\n";
echo " <th>Username</th>\n";
echo " <th>Password</th>\n";
echo " <th>E-mail</td>\n";
if ($credit)
{
echo " <th>Credit Limit</td>\n";
}
echo " <th>View/Modify</th>\n";
echo "</tr>\n";
$high_row = false;
foreach ($attendee_ids as $id)
{
$info = $attendee_session->GetAttendeeInfo($id, 0);
if ($high_row)
{
echo "<tr class=high>\n";
}
else
{
echo "<tr>\n";
}
$high_row = ! $high_row;
echo "<td><input type=checkbox name=attendee_id[] value=$info->id ></td>\n";
echo "<td>$info->username</td>\n";
echo "<td>$info->password</td>\n";
echo "<td>$info->email</td>\n";
if ($credit)
{
echo "<td>$info->credit_limit</td>\n";
}
echo "<td><a href=$module_url&action=modify&attendee_id=$info->id>View/Modify</a></td>\n";
echo "</tr>\n";
}
echo "</table>\n";
}