我在Windows Server 2008上运行了一个站点。
该网站是HTML,有两种形式,POST到PHP脚本(都发送电子邮件)。
但是当我点击页面上的提交按钮
时会出现此错误“405 - 不允许用于访问此页面的HTTP动词。 无法显示您要查找的页面,因为使用了无效的方法(HTTP动词)来尝试访问。“
浏览网页后,我尝试了一些解决方案,但似乎都没有。
我尝试在iis Manager中添加允许POST,GET的.html扩展名(通过添加托管处理程序),但这似乎不起作用。
任何想法?任何帮助将不胜感激!
编辑:
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 SCRIPT
<?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( "xxxxxxx@gmail.com", " 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>";
};
?>
答案 0 :(得分:1)
IIS是否配置为处理POST动词的PHP文件?听起来你需要为PHP文件添加POST动词,而不是HTML文件。