Forum Moderators: coopster
I know I need to make it into a multiple field for people to select who they are sending it to like:
<input type="checkbox" name="incoming_mailto[]" value="me@xyz.com">The Boss</input><br>
<input type="checkbox" name="incoming_mailto[]" value="me@myemail.com">The Accountant</input><br>
<input type="checkbox" name="incoming_mailto[]" value="user@thisplace.com">The Office Manager</input>
But I'm drawing a blank on how I set the form to handle the results so that each checkbox that is checked will be mailed a copy of the form. I can't seem to get past having only one email sent regardless of how many boxes are checked. I know it's PHP 101 stuff but I'm completely blank. Can you help or point me where I can find out?
<input type="checkbox" name="incoming_mailto[]" value="me">The Boss</input><br>
<input type="checkbox" name="incoming_mailto[]" value="Bob_Brady">The Accountant</input><br>
<input type="checkbox" name="incoming_mailto[]" value="Joe_User">The Office Manager</input><?php
// make array of all possible mails that could be used - a security check
$permittedmailsarray = Array(
'me' => 'me@xyz.com',
'Bob_Brady' => 'bob@hotmail.com',
'Joe_User'=> 'user@thisplace.com'
);
if(is_array($_POST['incoming_mailto'])) {
foreach($_POST['incoming_mailto'] as $v){
(do your mail stuff here, w/ $permittedmailsarray[$v] as the recipint address)
}
}
?>
I had intended to keep the email addresses hidden by putting them on the processing script itself. I only put them in the example to illustrate what I was looking to do.
Isn't it funny how something so simple can be so hard to recall? My thanks again.