Hello, any help would be greatly appreciated. I have two dropdowns with 2 options in each. Customer picks one option from each dropdown and the form gets emailed to addresses from the two selections. The code below gives and error.
My form:
<form method="POST" action="quote.php" onsubmit="return checkform(this)">
<input type="hidden" name="agent" value="recipient_1,recipient_2">
<input type="hidden" name="office" value="recipient_3,recipient_4">
<select name="agent" id="agent">
<option value="recipient_1">Agent1 </option>
<option value="recipient_2">Agent2 </option>
</select>
<select name="office" id="office">
<option value="recipient_3">Location1 </option>
<option value="recipient_4">Location2 </option>
</select>
<input type="submit" name="submit" value="Submit">
</form>
quote.php is below:
$recipients = array(
'recipient_1' => 'email_1@yahoo.com',
'recipient_2' => 'email_2@yahoo.com',
'recipient_3' => 'email_3@yahoo.com',
'recipient_4' => 'email_4@yahoo.com',
);
$exploded_recipients = explode(",",$_REQUEST['agent']);
foreach($exploded_recipients as $value)
{
$my_email = $recipients[$value];
$success = mail($my_email, $Subject, $Body, "From: <$EmailFrom>");
}
Thanks in advance