pelaej
02-22-2010, 06:30 PM
I am using phpMailer to email information from a form. On the form I am using check boxes for the people to CC: into the email. The check boxes are an array (ccs[]) and the value of each check box is the individual's email address. When I check off one person on the form the email is sent with no problems. When I check off more than one person though I get an error. I'm sure that it has something to do with the fact that I'm using a variable to fill my array but I can't figure out how to fix this problem and make it work.
Here is what I am doing in my code:
$ccsChecked = "";
foreach($_POST['ccs'] as $value2) {
$ccsChecked .= "$value2 ";
}
$emailAddresses = array("myEmail@email.com");
$ccAddresses = array($ccsChecked);
...
foreach($ccAddresses as $ccAddress) {
$mail->AddCC($ccAddress);
}
Any help is much appreciated! Thanks!
Here is what I am doing in my code:
$ccsChecked = "";
foreach($_POST['ccs'] as $value2) {
$ccsChecked .= "$value2 ";
}
$emailAddresses = array("myEmail@email.com");
$ccAddresses = array($ccsChecked);
...
foreach($ccAddresses as $ccAddress) {
$mail->AddCC($ccAddress);
}
Any help is much appreciated! Thanks!