This is a continuation of another thread that got off topic:
http://www.phpbuilder.com/board/showthread.php?s=&threadid=10227148
So here's the deal:
I have 2 arrays ($lm and $vc). If the selected country is in $lm
the info is emailed to $to1. If the country is in $vc it's emailed to
$to2. That works fine.
I'm now told to set this up for states as well. So if in $state1
it goes to $to1 if in $state2 it goes to $to2.
That works fine.
The problem is if Florida ($state1) and Mexico ($vc) then the
email is sent to both $to1 and $to2. Is there a way to say
something like if a state is selected then disregard the country
field for the purposes of the email?
// If state = E. USA mail to Lake Mary
$lms = array ("Alabama", "Arkansas", "Connecticut", "Delaware", "Maine"
, "DC", "Florida", "Georgia", "Illinois", "Indiana", "Iowa"
, "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland"
, "Massachusetts", "Michigan", "Mississippi", "Missouri"
, "New Hampshire", "New Jersey", "New York"
, "North Carolina", "Ohio", "Oklahoma", "Pennsylvania"
, "Rhode Island", "South Carolina" , "Tennessee", "Texas"
, "Vermont", "Virginia", "West Virginia", "Wisconsin");
if (in_array ("$state", $lms)) {
mail($to1, $subject, $message1, $headers);
}
// If state = W. USA mail to Canada
$vcs = array ("Alaska", "Arizona", "California", "Colorado", "Hawaii", "Idaho"
, "Minnesota", "Montana", "Nebraska", "Nevada"
, "New Mexico", "North Dakota", "Oregon", "South Dakota"
, "Utah", "Washington", "Wyoming");
if (in_array ("$state", $vcs)) {
mail($to2, $subject, $message1, $headers);
}
// If country = USA, Mexico, Carribean, S. America mail to Lake Mary
$lm = array ("USA", "Mexico", "Caribbean", "S. America");
if (in_array ("$country", $lm)) {
mail($to1, $subject, $message1, $headers);
}
// If country = W. USA, Canada, England, Ireland mail to Vancouver
$vc = array ("Canada", "England", "Ireland");
if (in_array ("$country", $vc)) {
mail($to2, $subject, $message1, $headers);
}
thanks to devinemke for the in_array suggestion by the way. Works great!