I have a simple contact form on my website that sends an email to different email addresses (different physical offices and email accounts) DEPENDING on which checkboxes the user fills out.
There are two checkboxes, one NMB and one MB for the values.
Here is what I want to do:
If one checkbox (NMB) is checked, send email to addy1
If one checkbox (MB) is checked, send to email addy2
If BOTH checkboxes (NMB and MB) is checked, send email to BOTH
SO, so far, I have this, but I suspect that its not going to work, or will send multiple emails….
$office = $_POST['office'];
if ($office == "NMB" ){
$address = "adyy1@narf.com";
}
elseif ($office == "MB" ){
$address = "adyy2@narf.com";
}
elseif ($office == "NMB" && $office == "MB" ){
$address = "addy1@narf.com,addy2@narf.com";
}
I feel I am close, but without a cigar. Thanks in advance for the help!
This should work, but I am not sure what the names are for your checkboxes. You can replace
cb1andcb2with the respective checkbox names.