我有一种表单需要根据用户在联系表单中选择的位置转到不同的所有者。我正在使用一个模板,并且已经能够编辑这些字段,让它们成为我想要的值,但是很难设法弄清楚如何将它传递给正确的人。根据下拉选择发送电子邮件给唯一的人
<?php
if(!$_POST) exit;
$email = $_POST['email'];
//$error[] = preg_match('/\b[A-Z0-9._%-][email protected][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 = "[email protected]";
$email_subject = "New Message: ".$_POST['subject'];
$email_content = "new message:\n";
foreach($values as $key => $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!';
}
}
?>
我想根据Location下拉菜单更改$ your_email所指向的人。并且总是CC一个特定的人。
形式是: http://amazinggaragefloors-net.si-sv3641.com/contactus.html