AFAIK since a label element's "for" attribute uses a DOM id reference you are required to give each checkbox a unique id.
Also name="cars[]" implies you are creating the form dynamically, so just add an iterator to the end of your id's for both input and label. for="car0" id="car0" for="car1" id="car1" and still happily use name="cars[]" Regards Chris Blown On Wed, 2004-02-11 at 15:03, James Ellis wrote: > This also reminds me of a question I've been meaning to ask: > > When submitting a form to a PHP script you can add [] to the form names: > > <input type="checkbox" name="cars[]" value="ford"> > <input type="checkbox" name="cars[]" value="holden"> > > This will cause the array element $_POST in PHP to have a value "cars" > which is an array..much better that posting cars0, cars1 to the script > and imploding them into an array. > > e.g $_POST['cars'] is an array([0]=>ford,[1]=>holden); > > How would we go about attaching a label to these individual form elements? > > Cheers > James > ***************************************************** > The discussion list for http://webstandardsgroup.org/ > ***************************************************** > > > ***************************************************** The discussion list for http://webstandardsgroup.org/ *****************************************************