title: prevent users acces URL php file
body: <p>I have made a simple contact form for my website with a validator, so users should enter all inputs before the contact form can be submitted. After submission, the user is directed to a php page, i.e. all contact information will then be send to mail. Unfortunately a user can bypass all the required inputs by just typing in the url of PHP. The result is an email with no inputs. </p>
  
  <p>How can i prevent users access the URL of my PHP file: see current php code below     </p>
  
  <pre><code>&lt;?php
  /* Subject and Email Variables */ 
  $emailSubject = ''; 
  $webMaster = '';
  /* Gathering Data Variables */ 
  $name = $_POST['Name']; 
  $adress = $_POST['Adresse']; 
  $email = $_POST['email']; 
  $body = &lt;&lt;&lt;EOD &lt;br&gt;&lt;hr&lt;br&gt; Name: $name &lt;br&gt; Adresse: $adress &lt;br&gt; Epost: $email &lt;br&gt; EOD; 
  $headers = "From: $email\r\n"; $headers = "Content-type: text/html\r\n";    
  $success = mail($webMaster, $emailSubject, $body, $headers); 
  /* Results rendered as HTML */ 
  $theResults = &lt;&lt;&lt;EOD EOD; echo "$theResults";     
  ?&gt;    
  </code></pre>