title: form action changes to mail.php when visiting domain
body: <p>I'm using a basic php for to mail myself from a website.<br>
  It's a single page website with the required PHP inside it, rather than a separate mail.php. I've used the built in validation and required fields, however when I visit the domain rather than domain/index.php the form code changes to make the action mail.php, no validation takes place and a blank email is sent.</p>
  
  <p>I want it to have all fields required, validated then display a small success message to let the user know their message has been sent.
  I've attached my code below.</p>
  
  <pre><code>&lt;?php            
  if($_SERVER["REQUEST_METHOD"] == "POST"){
     $name = test_input($_POST["name"]);
     $email = test_input($_POST["email"]);
     $message = test_input($_POST["message"]);
     $formcontent="From: $name \n Message: $message";
     $recipient = "me@domian";
     $subject = "Contact Form Subbmission";
     $mailheader = "From: $email \r\n";
     mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
     echo ("Thanks for getting in touch, I'll get back to you as soon as possible.");
  }
  //clean it
  function test_input($data){
     $data = trim($data);
     $data = stripslashes($data);
     $data = htmlspecialchars($data);
     return $data;
  }
  ?&gt;
  
  &lt;form method="post" action="&lt;?php echo htmlspecialchars($_SERVER['REQUEST_URI']);?&gt;#contact"&gt;
  &lt;div class="row 50%"&gt;
  &lt;div class="6u"&gt;&lt;input type="text" name="name" placeholder="Name" required="required"/&gt;&lt;/div&gt;
  &lt;div class="6u"&gt;&lt;input type="email" name="email" placeholder="Email" required="required"/&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="row 50%"&gt;
  &lt;div class="12u"&gt;&lt;textarea name="message" placeholder="Message" rows="6" required="required"&gt;    &lt;/textarea&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="row"&gt;
  &lt;div class="12u"&gt;
  &lt;ul class="actions"&gt;
  &lt;li&gt;&lt;input type="submit" value="Send Message" /&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Thanks in advance for any help you can offer</p>