Im creating an admin page in php that allows users to mail individual people from a database. the mail form is named frmCompose with a to field which when clicked is a popup with everyones name in the database by rows of 20, and there are currently bout 250 users. What im trying to do is check boxes on certain individuals, then when im all done selecting the individuals, click on a compose mail button, and it transfers the names i selected to the TO field of the email form. The mail form is complete as well as the popup...the problem is the javascript. heres the javascript i have in the popupwindow.

<script language="Javascript">

function SetChecked() {
var i=0
for( i=0 ; i<len ; i++) {
if (Sfrm.elements[i].name=='to[]' && Sfrm.elements[i].checked) {','+Sfrm.elements[i].value

function Compose() {

if (Vfrm != null) {
if ( == '') {
to = to.substring(1, to.length)
} += to
} = to.substring(1, to.length)

im also using these forms

echo "<FORM NAME=\"composeForm\">"; echo "<INPUT TYPE='hidden' NAME='to' VALUE=''>";
echo "</FORM>";
echo "<FORM NAME=\"addressForm\" method=\"post\">";

The first form stores the values, and the second form actually is the form with the list of people.

the checkbox code im using is this

echo "<input type=checkbox name=to[] value=\"$row->current_email\">\r\n";

Ok this code works without the [] and static checkboxes, but with the brackets in when i hit compose mail, i just got commas, in the To field of the email form depending on how
many people I check. I have read through the forums and found some problems with these brackets, I just can figure it out with my code here. Can someone please tell me whats wrong. Thanks.