表單生活在fictiveapp.com/這是第二個包含姓名,電子郵件和消息的表單。在HTML/PHP聯繫表單(鏈接問題?)上獲取404/405錯誤
我遇到兩個問題。
405錯誤 - 將最後的斜線,以解決上期我得到一個404錯誤,而不是當 - 我加入了trailing slash
404錯誤「解決」這一點。我對PHP很陌生,不確定我應該如何鏈接這些文件。我認爲這將與鏈接網站上的所有其他html文件相同,顯然不是。
我有所有的index.html,html_form_send.php和contactthanks.php都在同一個頂(1)一級目錄,用2級CSS,JS,字體,和IMG文件夾
所有relavent代碼如下
HTML
<div class="8u 12u$(small)">
<form name="htmlform" method="post" action="html_form_send.php">
<div class="row uniform 50%">
<div class="6u 12u$(xsmall)"><input type="text" name="name" id="name" placeholder="Name" /></div>
<div class="6u$ 12u$(xsmall)"><input type="email" name="email" id="email" placeholder="Email" /></div>
<div class="12u$"><textarea name="message" id="message" placeholder="Message" rows="4"></textarea></div>
</div>
<ul class="actions">
<li><input type="submit" value="Send Message" /></li>
</ul>
</div>
</form>
PHP從html_form_send.php
<?php
$EmailFrom = "[email protected]";
$EmailTo = "[email protected]";
$Subject = "from fictive site";
$Name = Trim(stripslashes($_POST['Name']));
$Email = Trim(stripslashes($_POST['Email']));
$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 .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php/\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
從contactthanks.php PHP
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<head>
<title>work already!</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="page-wrap">
<br /><br />
<h1>Your message has been sent!</h1><br />
<p><a href="index.html">Back to Site</a></p>
</div>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-68528-29";
urchinTracker();
</script>
我敢肯定它的一些愚蠢和簡單,但我已經好幾個小時,現在搜索論壇和似乎無法找到問題。
感謝您的任何幫助。
嘗試使用php重定向而不是html –