Reputation: 57
I am trying to to loop through a select drop-down menu and send an email to multiple recipients. Every time I add a comma to add multiple emails the form fails. Here are the chunks of code I am working with, but I would like to add more email address for 'recipient_1' 2 and 3 separated by a comma.
$recipients = array(
'recipient_1' => '[email protected],
'recipient_2' => '[email protected]',
'recipient_3' => '[email protected]'
);
$to = $recipients[$_REQUEST['recipient']];
mail($to, $subject, $body, $headers);
<select name="recipient" id="location" tabindex="20">
<option value="-1">--- Please Select ---</option>
<option value="recipient_1">City 1</option>
<option value="recipient_2">City 2</option>
<option value="recipient_3">City 3</option>
</select>
Upvotes: 0
Views: 845
Reputation: 908
i had created this kind of things using javascript.. take a look at my example here
Upvotes: 0
Reputation: 360672
You're missing a closing quote after the first recipient_1
:
'recipient_1' => '[email protected],
^--here
that'd cause a syntax error.
Upvotes: 2