Home >Backend Development >PHP Tutorial >为什么小弟我的表单每次刷新或者进入网站都会自动先发送一次

为什么小弟我的表单每次刷新或者进入网站都会自动先发送一次

WBOY
WBOYOriginal
2016-06-13 11:29:191040browse

为什么我的表单每次刷新或者进入网站都会自动先发送一次

 















$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;
}

?>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn