HTTP Error - 405

by 5 replies
6
So I don't know too much about PHP or creating forms, this is my first try here. I'm using a Network Solutions web hosting. When ever I submit the form it goes to my sendmail.php page and give me an HTTP Error - 405 (page cannot be displayed) and never sends the form.

Here's the code I'm using

Code:
<?php
  $email = $_POST['email'];
  $message = $_POST['message'];

  mail( "myemail@myemail.com", "Feedback Form Results",
    $message, "From: $email" );
  header( "Location: URL" );
?>
Very simple. I don't think the problem would lie in the HTML. Anyone have a solution to my problem? Where do I go from here?

HTML Code

Code:
<form method="post" action="sendmail.php"> 
  Email: <input name="email" type="text" /><br /> 
  Message:<br /> 
  <textarea name="message" rows="15" cols="40"> 
  </textarea><br /> 
  <input type="submit" /> 
</form>
#programming #405 #error #http
  • It definitely seems as there is a problem with your hosting.

    Error 405 means that the HTTP method (get/post/put/delete, in your case post) isn't supported. You should try to run the script in a local environment like XAMPP and if there are no errors there (besides the e-mail not getting delivered) then you should complain to your hoster.
  • Try changing the method to get instead of post.

    <form method="get" action="sendmail.php">

    if that doesnt work. Contact hosting support, or get a new host.

    I can get you setup with us on a free one month trial if you like.
    • [1] reply
    • Don't forget to change the variables from $_POST to $_GET then. Though I think that this is an unacceptable flaw if you can't use the post method.

      The message will be transported via the URL of the form then and so someone might accidentally send you the message many times.
      • [1] reply

Next Topics on Trending Feed

  • 6

    So I don't know too much about PHP or creating forms, this is my first try here. I'm using a Network Solutions web hosting. When ever I submit the form it goes to my sendmail.php page and give me an HTTP Error - 405 (page cannot be displayed) and never sends the form. Here's the code I'm using