Sorry Anarchos, you're right, you posted it first... I changed to question a bit while trying.
The function I use now is:
PHP Code:
<!--
function CheckEm(recipients){
if (document.mailer.cb_all.checked == true){
for (var i = 0; i < document.mailer[recipients[]].length; i++)
document.mailer[recipients][i].checked = true;
}
else {
for (var i = 0; i < document.mailer[recipients[]].length; i++)
document.mailer[recipients][i].checked = false;
}
}
//-->
and in the form it reads:
PHP Code:
<form name='mailer' method='POST' action='mail_multiple_1.php'>
<input type=checkbox name='cb_all' onClick=\"CheckEm('recipients')\"><br>
$RelationQuery = mysql_query("SELECT * FROM relation");
if(mysql_num_rows($RelationQuery) > 0) {
while ($rows = mysql_fetch_array($RelationQuery)){
extract($rows);
print "<tr><td><input type=checkbox value='$rid' name='recipients[]'>$firstName $lastName</td><td>$email</td></tr>";
}
}
I get an error, reading that 'Object is expected'.
What am I doing wrong?
PS: thanks goes out to Anarchos for writing the first part of the code!!!
Bookmarks