The code that I am trying to mail with is causing me problems. I want someone to be able to choose a radio button to determine whom to mail (2 choices). Currently if no radio button is chosen mail is sent to both addresses – this works. If you choose one of the buttons mail does not send to target. Below is the pertinant code.
<form action="code/submitemailCopy.php" method="post" name="submitform" id="submitform">
<p>
<label>
<input type="radio" name="toaddress" value="tim" id="tim">Tim/label>
<label>
<input type="radio" name="toaddress" value="terry" id="terry">Terry</label>
$mailto = $_POST['toaddress'];
if ($mailto == 'terry')
$mailto = 'example1@example.com';
elseif ($mailto == 'tim')
$mailto = 'example2@example.com';
else
$mailto = 'example1@example.com' . ',';
$mailto .= 'example2@example.com;
You need to use code blocks. Your last line is always executed, so you end up with
$mailtovalue likeexample1@example.comexample2@example.comorexample2@example.comexample2@example.com