Hey all!

I'm including some javascript that enables a button in a form           <input 
type="button" name="CheckAll" value="Check All"
onClick="checkAll(document.myform.email)">                to check all the check boxes 
at once. (I have an array of check boxes from a mysql db)

I use:

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function checkAll(field)
{
for (i = 0; i < field.length; i++)
 field[i].checked = true ;
}

function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
 field[i].checked = false ;
}
//  End -->
</script>

So... In order to use this script my button has to have 
onClick="checkAll(document.myform.email)" and my check boxes have to have name="email" 
but i need to name them name="email[]" in order to pass the variables as an array in 
php. ive tried using onClick="checkAll(document.myform.email[])" but that just gives 
me an error for obvious reasons im sure. I don't know jack about javascript, so if you 
know of a better way to make a button that selects all check boxes or another way to 
code how the check boxes values are passed to the next page, I would be so greatful.

Thanks!
Nate

Reply via email to