title: empty $_POST in PHP mail()
body: <p>Some help with the following would be greatly appreciated! I've been searching the web and stackoverflow for hours. There is this problem with my php mail function.</p>
  
  <p>There's a form on my website (the site uses wordpress) with two text fields, name and phone number. There's also a hidden field in the form that displays the current url, so we can see on what page the form was filled in. This information is also stored in a php session.</p>
  
  <pre><code>&lt;?php session_start();
  $_SESSION['url'] = $_SERVER['REQUEST_URI']; 
  ?&gt; 
  
  &lt;form name="callback" action="callme.php" method="post" onsubmit="return(validate());"&gt;
  &lt;label&gt;Name:&lt;/label&gt;&lt;input type="text" name="name" size=15 /&gt;
  &lt;label&gt;Tel:&lt;/label&gt;&lt;input class="sky" type="text" name="tel" size=15 /&gt;
  &lt;div id="afterfive"&gt;&lt;p&gt;Call after five&lt;input type="checkbox" name="afterfive" value="Call back after five"&gt;&lt;/p&gt;&lt;/div&gt;
  &lt;input type="hidden" name="url" value="&lt;?php echo $_SESSION['url']; ?&gt;"&gt;
  &lt;input type="submit" class="classname" value="Call me back!" title="Call me back!" /&gt;
  &lt;/form&gt;
  
  &lt;script&gt;
  function validate()
  {
  if( document.callme.name.value == "" )
  {
   alert( "Please fill in your name" );
   document.callme.name.focus() ;
   return false;
   }
  if( document.callme.tel.value == "" )
  {
  alert( "Please fill in your phone number" );
  document.callme.tel.focus() ;
  return false;
  }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>The following php code is callme.php:</p>
  
  <pre><code>&lt;?php session_start();
  
  $name = $_POST['name'];
  $tel = $_POST['tel'];
  $afterfive = $_POST['afterfive']; 
  $url = $_POST['url'];
  
  $to = "me@myemail.com";
  $subject = "Please call back $name";
  $message .= "Hi, the following person would like to be called back: \n";
  $message .= "Name: $name \n";
  $message .= "Phonenumber: $tel \n";
  $message .= "$afterfive \n";
  $message .= "This message was send from this page: $url \n";
  $headers = "From: meagain@myemail.com" . "\r\n";
  $headers .= "BCC: meagain@myemail.com" . "\r\n";
  
  if(mail($to, $subject, $message, $headers)){
  $_SESSION['name'] = $_POST['name'];
  $_SESSION['tel'] = $_POST['tel'];
  header("Location: http://www.mywebsite.thankyou");
  }
  
  ?&gt;
  </code></pre>
  
  <p>After submitting the form, the visitor is redirected to our thankyou page and given the opportunity the fill in additional information using a second form. The information previously stored in the php session (form fields name, tel and url) are added in hidden form fields.</p>
  
  <p>This all works fine most of the time, but sometimes we receive e-mails with all or some fields empty. Of course this could be users with javascript disabled or google bots that submit blank forms, but the weird thing is that sometimes even the url field is empty (the form is not visible on our homepage). Shouldn't $_SERVER['REQUEST_URI'] always still work?</p>
  
  <p>I was thinking about adding php form validation, but I'm not sure this will solve the problem. Could this have something to do with the hyper cache plug-in for wordpress? Or could it be related to the php session?</p>