为什么我的表单每次刷新或者进入网站都会自动先发送一次
$name = isset($_POST['uname'])?$_POST['uname']:"";
$phone = isset($_POST['phone'])?$_POST['phone']:"";
$company = isset($_POST['company'])?$_POST['company']:"";
$message = isset($_POST['message'])?$_POST['message']:"";
$msg = "name:".$name."
"."phone:".$phone."
"."company:".$company."
"."message:".$message;
$to = "[email protected]";
$subject = "Soriana Contact";
$from = $name;
$headers = "From: {$name}";
if(mail($to,$subject,$msg,$headers)){
echo "<script>alert('Thanks for your support')</script>";
}else{
echo "<script>alert('Failed')</script>";
return false;
}
?>