2010-09-09 115 views
0

我有一个网站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>&nbsp;</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>&nbsp; $email<br></br><br></br> 
    <strong>Phone:</strong>&nbsp; $tel<br></br><br></br> 
    <strong>Company:</strong>&nbsp; $comp<br></br><br></br> 
    <a //href=\"javascript:history.go(-1)\"> Click here to return to the contact page.</a></br>"; 
    }; 

    ?> 
+1

您是否有重新编写URL?如果sop将它们附加到您的OP。 – RobertPitt 2010-09-09 14:57:48

+0

我已经更新了我正在使用的代码。我已经与我自己的托管公司一起尝试过,并且它已经工作,所以我相信这不是代码。我想这是与IIS服务器设置有关,但我只是不熟悉这个领域。 – 109221793 2010-09-09 15:02:10

回答

1

是IIS配置来处理PHP文件POST动词?这听起来像你需要为PHP文件添加POST动词,而不是HTML文件。

+0

嗨,我已经通过进入处理程序映射,并编辑PHP脚本映射来处理POST动词在IIS中尝试过。但我仍然得到相同的回应。 – 109221793 2010-09-09 15:12:09