title: i am trying to send an email from my contact us page to email by php but it gives error my code and error given below
body: <p>this is my html code.</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;form&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
                          &lt;form action=&quot;send.php&quot; method=&quot;post&quot; class=&quot;contact-form contact_form_u&quot; id=&quot;&quot;&gt;
                              &lt;div class=&quot;form-group&quot;&gt;
                                  &lt;input class=&quot;form-control  contact_user_fname&quot; id=&quot;user-fname&quot; name=&quot;user-fname&quot; type=&quot;text&quot; placeholder=&quot;First name :&quot; required&gt;
                              &lt;/div&gt;
                              &lt;div class=&quot;form-group&quot;&gt;
                                  &lt;input class=&quot;form-control  contact_user_lname&quot; id=&quot;user-lname&quot; name=&quot;user-lname&quot; type=&quot;text&quot; placeholder=&quot;Last name :&quot; required&gt;
                              &lt;/div&gt;
                              &lt;div class=&quot;form-group&quot;&gt;
                                  &lt;input class=&quot;form-control  contact_user_email&quot; id=&quot;user-email&quot; name=&quot;user-email&quot; type=&quot;email&quot; placeholder=&quot;Email :&quot; required&gt;
                              &lt;/div&gt;
                              &lt;div class=&quot;form-group&quot;&gt;
                                  &lt;input class=&quot;form-control  contact_user_phone&quot; id=&quot;user-phone_&quot; name=&quot;user-phone&quot; type=&quot;text&quot; placeholder=&quot;Phone :&quot; required&gt;
                              &lt;/div&gt;
                              
                              &lt;div class=&quot;form-group&quot;&gt;
                                  &lt;textarea class=&quot;form-control contact_user_message&quot; name=&quot;user-message&quot; id=&quot;user-message&quot; placeholder=&quot;Message:&quot; required&gt;&lt;/textarea&gt;
                              &lt;/div&gt;
                              &lt;div class=&quot;form-group&quot;&gt;
                                  &lt;button type=&quot;submit&quot; class=&quot;btn btn-info btn-lg btn--highlight contact_btn_u&quot; id=&quot;submit-btn&quot; name=&quot;submit-btn&quot;&gt;Send &lt;/button&gt;
                              &lt;/div&gt;
                              &lt;div class=&quot;form-group&quot;&gt;
                                  &lt;a class=&quot;btn btn-info btn-lg btn--highlight contact_btn_u_c&quot; id=&quot;close_contact&quot;  type=&quot;submit&quot;&gt;Close&lt;/a&gt;
                              &lt;/div&gt;
                              &lt;div id=&quot;response&quot;&gt;&lt;/div&gt;
                          &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>this is my php code</p>
  <pre><code>&lt;?php
  if (!isset($_POST[&quot;submit&quot;]))
  {
      echo &quot;error; you need to submit the form&quot;;
  }
  $fname =$_POST[&quot;user-fname&quot;];
  $lname =$_POST[&quot;user-lname&quot;];
  $email =$_POST[&quot;user-lname&quot;];
  $phone =$_POST[&quot;user-lname&quot;];
  $message =$_POST[&quot;user-lname&quot;];
  
  if (empty($fname) || empty($lname) || empty($email) || empty($phone) || empty($message)){
      echo &quot;please fill all the fields&quot;;
      exit;
  }
  else
  {
      mail(&quot;email@gmail.com&quot;, &quot;company Message&quot;, $message, &quot;From: $fname &lt;$email&gt;&quot;);
      echo &quot;&lt;script type='text/javascript'&gt;alert('Your message sent successfully');
      window.history.log(-1);
      &lt;/script&gt;&quot;;
  }
  ?&gt;
  </code></pre>
  <p>when i am click on the submit button.it's taking me to send.php page but it's gives me an error which is given below.
  how can i solve it.</p>
  <p>This page isn’t working If the problem continues, contact the site owner.
  HTTP ERROR 405</p>