I would say do something like this instead:
<input type="checkbox" name="emails[]" value="me@email.com">
<input type="checkbox" name="emails[]" value="you@email.com">
<input type="checkbox" name="emails[]" value="thirdperson@email.com">
Then, in your PHP, you'd do:
$to = 'To: <' . implode('>, <', $_POST['emails']) . '>';
Now, keep in mind that this method allows hackers to abuse your form and mail anyone they want. Instead, you might do something like:
<input type="checkbox" name="emails[]" value="0"> me@email.com
<input type="checkbox" name="emails[]" value="1"> you@email.com
<input type="checkbox" name="emails[]" value="2"> thirdperson@email.com
and then define the valid e-mail addresses in your script:
$valid_emails = array('me@email.com', 'you@email.com', 'thirdperson@email.com');
$emails = '';
foreach($_POST['emails'] as $email)
if(isset($valid_emails[$email]))
$emails .= '<' . $valid_emails[$email] . '>, ';
$to = 'To: ' . rtrim($emails, ', ');
EDIT: Also, couple of things. If you want to save yourself from some repetition, you could dynamically create the checkboxes on the form from your $valid_emails array, meaning that if you add/remove an address later on, no extra work is needed (e.g. typing the same address again in the HTML for the form).
Lastly, keep in mind this quote from the manual for [man]function.mail[/man]:
PHP.net manual wrote:Note: It is worth noting that the mail() function is not suitable for larger volumes of email in a loop. This function opens and closes an SMTP socket for each email, which is not very efficient.
For the sending of large amounts of email, see the » PEAR::Mail, and » PEAR::Mail_Queue packages.