i want to send bcc and cc if uers click the checkhox.it is not working

$body2.="<html><body>";
$body2.="<b>With Regards,</b><br/><b>CG Group</b>";
$body2.="</body></html>";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1" . "\r\n";
if (strlen($body2)>998) {
if($option1=1)
 {
 $headers .= "Content-Transfer-Encoding: base64;" . "\r\n";
$headers = "To: $to\r\n";
$headers .= 'From: ' . $from . "\r\n" .'X-Mailer: PHP/' . phpversion();
}
 else if($option1=1 && $option2=2)
 {
 $headers .= "Content-Transfer-Encoding: base64;" . "\r\n";
$headers = "To: $to\r\n";
$headers .= "Cc: $to1\r\n";
$headers .= 'From: ' . $from . "\r\n" .'X-Mailer: PHP/' . phpversion();
}
 else if($option1=1 && $option2=2 && $option3=3)
 {
 $headers .= "Content-Transfer-Encoding: base64;" . "\r\n";
$headers = "To: $to\r\n";
$headers .= "Cc: $to1\r\n";
$headers .= "bcc: $to2\r\n";
$headers .= 'From: ' . $from . "\r\n" .'X-Mailer: PHP/' . phpversion();
}
else
{
}
}
$sent = mail($toa, $subject1, $body2, $headers);
}
?>
<form method="post" action="to.php">
<table height="72" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td><input type="hidden" name="seekers" value="<? echo $seeker; ?>"><td></td>
<tr><td><input type="checkbox" name="option1" value="1">&nbsp;&nbsp;Recipient 1</td>
<td width="282">
<input name="to"  type="text"  size="50"  value="<? echo $cemail[0]["contactperson1email"]; ?>">
</td></tr>
<tr><td><input type="checkbox" name="option2" value="2">&nbsp;&nbsp;Recipient 2</td>
<td width="282"> <input name="to1"  type="text"  size="50"   /></td></tr>
<tr><td><input type="checkbox" name="option3" value="3">&nbsp;&nbsp;Recipient 3</td>
<td width="282"> <input name="to2"  type="text"  size="50"   /></td></tr>
<tr><td>Subject</td><td><input type="text" name=subject" size="80"></td></tr>
<tr>
<td colspan="2" align="center"> <input name="Submit1" type="submit" value="send" /></td>
</tr>
</table>
</form>

the code is display the html as it is

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.