0

I have a site running on windows server 2008.

The site is HTML, and has two forms which POST to PHP scripts (both to send an email).

This error comes up however when I click the submit button on the page

"405 - HTTP verb used to access this page is not allowed. The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access."

After looking around on the web, I've tried a few solutions but none seem to work.

I've tried adding a .html extension allowing POST, GET in iis Manager (through adding a managed handler) however this doesn't seem to work.

any ideas? any help would be appreciated!

EDIT:

HTML FORM CODE:

<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 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>&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>";
    }; 

    ?>
109221793
  • 16,477
  • 38
  • 108
  • 160
  • 1
    Do you have and URL Rewrites ? if sop append them to your OP. – RobertPitt Sep 09 '10 at 14:57
  • I have updated with the code I am using. I have tried this with my own hosting company and it has worked, so I'm confident it's not the code. I'm thinking it's something to do with the IIS server set up but I'm just not familiar with this area. – 109221793 Sep 09 '10 at 15:02

1 Answers1

1

Is IIS configured to handle PHP files for POST verbs? It sounds like you need to add the POST verb for PHP files, not HTML files.

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
  • Hi, I have tried this in IIS through going into Handler Mappings, and editing the PHP script map to handle the POST verb. I still however get the same response. – 109221793 Sep 09 '10 at 15:12