我有一個網站Windows Server 2008的405 HTTP錯誤 - PHP POST
該網站是HTML,並且有兩種形式,其POST到PHP腳本上運行(包括髮送電子郵件)。然而
這個錯誤出現,當我點擊提交頁面
「405上的按鈕 - 用來訪問本頁面的HTTP動詞是不允許 您正在尋找無法顯示,因爲無效的方法在頁(HTTP動詞)被用來嘗試訪問。「
環顧四周後,我嘗試了一些解決方案,但似乎沒有任何工作。
我試過添加一個.html擴展,允許POST,GET在iis管理器中(通過添加託管處理程序),但是這似乎不起作用。
有什麼想法?任何幫助,將不勝感激!
編輯:
HTML表單代碼:
<form id="form1" name="form1" method="post" action="mail.php">
<fieldset>
<legend><strong>Please fill out our contact form</strong></legend>
<table width="622" border="0">
<tr>
<td width="277">Name*</td>
<td width="335"><input class="purple" name="nickname" type="text" id="nickname" /></td>
</tr>
<tr>
<td>EMail*</td>
<td><input class="purple" name="email" type="text" id="email" /></td>
</tr>
<tr>
<td>Phone No.</td>
<td><input class="purple" name="tel" type="text" id="tel" /></td>
</tr>
<tr>
<td>Company Name*</td>
<td><input class="purple" name="comp" type="text" id="comp" /></td>
</tr>
<tr>
<td>Query</td>
<td><textarea class="purple" name="message" cols="53" rows="10" id="message"></textarea></td>
</tr>
<tr>
<td colspan="2" align="center"><input name="Submit" type="submit" value="Submit"/>
<label>
<input name="reset" type="reset" id="reset" value="Reset" />
<input type="hidden" name="ip" value=" echo $REMOTE_ADDR; " />
</label></td>
</tr>
<tr>
<td>*Required Fields</td>
<td></td>
</tr>
<tr>
<td colspan="2"><h3>Why not call us? 021 4868150</h3>
<p> </p></td>
</tr>
</table>
</fieldset>
</form>
PHP腳本
<?php
$nickname = $_REQUEST['nickname'] ;
$email = $_REQUEST['email'] ;
$tel = $_REQUEST['tel'] ;
$comp = $_REQUEST['comp'] ;
$message = $_REQUEST['message'] ;
// Let's check if all fields are filled in!
if(empty($nickname) || empty($email) || empty($comp))
{
$error = "All of the required fields have not been completed, <a href=\"javascript:history.go(-1)\">please click here to go back.</a>";
}
else
{
$content= "$nickname has sent you an e-mail from ePubDirect
Query:
$message
You can contact $nickname via Email: $email. <br />Other relevant details of individual: <br />Telephone Number: $tel <br />Company: $comp";
mail("[email protected]", " Query", $content, "From: $email"); //first thing has to be address it is going to, then what the subject of the mail should be, the content and a from address which will be the query submitter.
echo "<h2>$nickname</h2><br></br>
Your query has been succesfully sent. <br></br><br></br>
We will deal with this query and be in touch as soon as possible.<br></br><br></br><br></br>
The contact details you submitted are: <br></br><br></br>
<strong>Email:</strong> $email<br></br><br></br>
<strong>Phone:</strong> $tel<br></br><br></br>
<strong>Company:</strong> $comp<br></br><br></br>
<a //href=\"javascript:history.go(-1)\"> Click here to return to the contact page.</a></br>";
};
?>
您是否有重新編寫URL?如果sop將它們附加到您的OP。 – RobertPitt 2010-09-09 14:57:48
我已經更新了我正在使用的代碼。我已經與我自己的託管公司一起嘗試過,並且它已經工作,所以我相信這不是代碼。我想這是與IIS服務器設置有關,但我只是不熟悉這個領域。 – 109221793 2010-09-09 15:02:10