I'm having problems with checkboxes in both Javascript and PHP.

What I have is a basic form with an array of check boxes where the user can check off the relevant options - the restriction is that they must select at least one checkbox from the list before proceeding.

I therefore use javascript to make sure they've checked at least one box.

And then on the next page, I have it store what boxes they checked into my database.

Here's a chunk of the form code:

PHP Code:
<input name="box[]" type="checkbox" id="box[]" value="1">
input name="box[]" type="checkbox" id="box[]" value="2">
input name="box[]" type="checkbox" id="box[]" value="3">

input type="submit" value="Next" onClick="return checkForm(this.form);"
Note that I want to use "box[]" instead of "box1", "box2", etc so that it will become an array on the next page for PHP to process.

The whole problem is that when I try and detect in my "checkForm" javascript function if at least one box has been checked, I get these stupid Invalid Object errors.

In other words, it's not properly accessing these check boxes.
I know how to see if a box has been checked when they aren't in the array form like above, but I need them to be in that array form for the PHP processing.

Does anyone know the javascript code to go through the boxes and detect if at least one has been checked?

I've tried javascript code like:


But that gives me an object error.
Thanks if you can help.