PHP/java Script select all button
Posted: Wed Jul 04, 2007 2:07 pm
Ok this is a bit complicated i hope i explain it correctly.
I have a news letter script, i have a place where you can manually select (with a check box) the people you want to send to. <input type=checkbox name=users[]>
I'm using users[] because it adds it to an arrray and i can send to everyone in the array.
function checkAll(field)
{
for (i = 0; i < field.length; i++)
field.checked = true ;
}
function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
field.checked = false ;
}
Is my java script
<input type="button" class="submit" name="CheckAll" value="Check All" onClick="checkAll(document.myform.users)">
is my submit javascript
<tr bgcolor=#eeeeee><td><input type=checkbox name=\"users\" value=$email></td><td>$lastname</a></td><td>$firstname</td><td>$email</td><td>$birthday</td>
Is my check box.
when i have name=users it works great.
But when i have name=users[] and i add users[] to the top from just users it doesn't.
How can i do this and still have the array? Do i need to do something witht he php code or do i need to change something in the javascript.
if so what?
thanks
I have a news letter script, i have a place where you can manually select (with a check box) the people you want to send to. <input type=checkbox name=users[]>
I'm using users[] because it adds it to an arrray and i can send to everyone in the array.
function checkAll(field)
{
for (i = 0; i < field.length; i++)
field.checked = true ;
}
function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
field.checked = false ;
}
Is my java script
<input type="button" class="submit" name="CheckAll" value="Check All" onClick="checkAll(document.myform.users)">
is my submit javascript
<tr bgcolor=#eeeeee><td><input type=checkbox name=\"users\" value=$email></td><td>$lastname</a></td><td>$firstname</td><td>$email</td><td>$birthday</td>
Is my check box.
when i have name=users it works great.
But when i have name=users[] and i add users[] to the top from just users it doesn't.
How can i do this and still have the array? Do i need to do something witht he php code or do i need to change something in the javascript.
if so what?
thanks