/*PHP程式部分
一開始先過濾掉完全空白*/
if($Com != "" | $Name != "" | $Tel != "" | $EMail != "" | $Detail != "")
{
//當不允許空白欄位都輸入資料時就發出E-Mail
if($Com != "" | $Name != "" & $Tel != "" & $EMail != "" & $Detail != "")
{
//定義要寄給誰
$MailTo = "web@mail.comstory.com";
//設定信件主旨
$Subject = "[資治線上留言] 來自".$Com."的訊息......";
//設定信件內容
$Message = "以下內容是SMT線上留言的資料:\n";
$Message = $Message."留言者公司:".$Com."\n";
$Message = $Message."留言者姓名:".$Name."\n";
$Message = $Message."留言者電話:".$Tel."\n";
$Message = $Message."留言者地址:".$Addr."\n";
$Message = $Message."留言者信箱:".$EMail."\n";
$Message = $Message."留言內容:".$Detail."\n";
//清空數值
$Com = "";
$Name = "";
$Tel = "";
$EMail = "";
$Detail = "";
//發E-Mail
mail($MailTo,$Subject,$Message);
echo "謝謝您!我們會儘快與您聯絡!";
}
//當不允許空白欄位有空白時就提示錯誤訊息
else
{
$ErrorMessage = "您忘了輸入";
if($Com == "")$ErrorMessage = $ErrorMessage." 公司 ";
if($Name == "")$ErrorMessage = $ErrorMessage." 姓名 ";
if($Tel == "")$ErrorMessage = $ErrorMessage." 電話 ";
if($EMail == "")$ErrorMessage = $ErrorMessage." E-Mail ";
if($Detail == "")$ErrorMessage = $ErrorMessage." 留言內容 ";
$ErrorMessage = $ErrorMessage."等欄位。";
echo $ErrorMessage;
}
}
else
{
include("contact.htm");
}
?>
|