Send email to unique person based on drop-down selection
<p>I have a form that needs to go to different owners depending on the location that the user selects in the contact form.  I'm using a template and have been able to edit the fields to have them be the values I want, but having difficulty trying to figure out how to get it to the correct person.</p>

<pre><code>&lt;?php

if(!$_POST) exit;  

$email = $_POST['email'];

//$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]  {2,}"."$",$email )){
$error.="Invalid email address entered";
$errors=1;
}
if($errors==1) echo $error;
else{
$values = array ('location','name','email','phone','message');
$required = array('location','name','email','phone','message');

$your_email = "jhutchins@sealkc.com";
$email_subject = "New Message: ".$_POST['subject'];
$email_content = "new message:\n";

foreach($values as $key =&gt; $value){
  if(in_array($value,$required)){
    if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
    $email_content .= $value.': '.$_POST[$value]."\n";
  }
}

if(

if(@mail($your_email,$email_subject,$email_content)) {
    echo 'Message sent!'; 
} else {
    echo 'ERROR!';
}
   }
?&gt;
</code></pre>

<p>I would like to change who the $your_email is pointed to based on the Location drop down menu.  And always CC one specific person as well.</p>

<p>The form is at:
<a href="http://amazinggaragefloors-net.si-sv3641.com/contactus.html" rel="nofollow">http://amazinggaragefloors-net.si-sv3641.com/contactus.html</a></p>
