0

我有一个在 windows server 2008 上运行的站点。

该站点是 HTML,并且有两种形式可以 POST 到 PHP 脚本(都用于发送电子邮件)。

但是,当我单击页面上的提交按钮时,会出现此错误

“405 - 不允许用于访问此页面的 HTTP 谓词。您正在查找的页面无法显示,因为尝试访问时使用了无效的方法(HTTP 谓词)。”

在网上四处查看后,我尝试了一些解决方案,但似乎都没有奏效。

我尝试在 iis 管理器中添加一个允许 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>&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( "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>&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>";
    }; 

    ?>
4

1 回答 1

1

IIS 是否配置为处理 POST 动词的 PHP 文件?听起来您需要为 PHP 文件而不是 HTML 文件添加 POST 动词。

于 2010-09-09T15:05:32.543 回答