-1
我有一個聯繫表單,在我的page上提交時表示'訪問被拒絕'。沒有別的,所以我似乎無法弄清楚如何調試。訪問被拒絕。 PHP腳本
下面是代碼:
<?php
$EmailFrom = "[email protected]";
$EmailTo = "[email protected], [email protected]";
$Subject = "Subject";
$Name = Trim(stripslashes($_POST['Name']));
$Company = Trim(stripslashes($_POST['Company']));
$Email = Trim(stripslashes($_POST['Email']));
$Tel = Trim(stripslashes($_POST['Tel']));
$Message = Trim(stripslashes($_POST['Message']));
// Validation
$validationOK = true;
if (! $validationOK)
{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// Prepare Email Body Text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Company: ";
$Body .= $Company;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "Further comments: ";
$Body .= $Message;
$Body .= "\n";
// Send Email
$success = mail($EmailTo, $Subject, $Body, "From: <$Email>");
// Redirect To Success Page
if ($success)
{
echo '<script>alert("Thanks for your message, somebody will get in touch with your shortly.");</script>';
echo "<meta http-equiv=\"refresh\" content=\"0;URL=../contact\">";
}
else
{
echo '<script>alert("There has been an error, please try again later.");</script>';
echo '<script>history.back(1);</script>';
exit;
}
?>
我不知道爲什麼它不工作,可能有人闡明這一些輕?
請不要鏈接到實時代碼。它可以確保在修復實時代碼後您的問題沒有用處,從而不再出現問題。 – meagar