title: php header not header function is not working
body: <p>I have got an issue where the PHP header is not working. Here is the full code. Everything is working fine only the page is not redirected at the end.</p>
  
  <pre><code>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="js/jquery.tabSlideOut.v1.3.js"&gt;&lt;/script&gt;
      &lt;script&gt;
           $(function(){
               $('.slide-out-div').tabSlideOut({
                   tabHandle: '.handle',                              //class of the element that will be your tab
                   pathToTabImage: '',          //path to the image for the tab (optionaly can be set using css)
                   imageHeight: '273px',                               //height of tab image
                   imageWidth: '63px',                               //width of tab image    
                   tabLocation: 'right',                               //side of screen where tab lives, top, right, bottom, or left
                   speed: 300,                                        //speed of animation
                   action: 'click',                                   //options: 'click' or 'hover', action to trigger animation
                   topPos: '200px',                                   //position from the top
                   fixedPosition: false                               //options: true makes it stick(fixed position) on scroll
               });
           });
  
           &lt;/script&gt;
               &lt;script src="js/form_value.js"&gt;&lt;/script&gt;
               &lt;script type="text/javascript"&gt;
  &lt;!--
  function validateEmail()
  {
  
     var emailID = document.myForm.email.value;
     atpos = emailID.indexOf("@");
     dotpos = emailID.lastIndexOf(".");
     if (atpos &lt; 1 || ( dotpos - atpos &lt; 2 )) 
     {
         alert("Please enter correct email ID")
         document.myForm.email.focus() ;
         return false;
     }
     return( true );
  }
  
  function validate()
  {
     if( document.myForm.fname.value == "" )
     {
       alert( "Please provide your First name!" );
       document.myForm.fname.focus() ;
       return false;
     }
  
      if( document.myForm.lname.value == "" )
     {
       alert( "Please provide your Last name!" );
       document.myForm.lname.focus() ;
       return false;
     }
     if( document.myForm.phone.value == "" ||
             isNaN( document.myForm.phone.value ) ||
             document.myForm.phone.value.length &lt; 8 )
     {
       alert( "Please provide a valid phone number" );
       document.myForm.phone.focus() ;
       return false;
     }
     if( document.myForm.email.value == "" )
     {
       alert( "Please provide a valid Email address" );
       document.myForm.email.focus() ;
       return false;
     }else{
       // Put extra check for data format
       var ret = validateEmail();
       if( ret == false )
       {
            return false;
       }
     }
  
     if( document.myForm.city.value == "" )
     {
       alert( "Please provide your City" );
       document.myForm.city.focus() ;
       return false;
     }
     return( true );
  }
  //--&gt;
  &lt;/script&gt;
  
  
  &lt;body&gt;
  
  &lt;div id="wrapper"&gt;
      &lt;div id="footer"&gt;
          &lt;div id="footer_inside"&gt;
          &lt;span class="number"&gt;******&lt;/span&gt;
          &lt;div id="follow"&gt;
          &lt;span&gt;Follow us on :&lt;/span&gt;
  
          &lt;/div&gt;
          &lt;/div&gt;
          &lt;/div&gt;&lt;!-- #footer --&gt;
  
      &lt;/div&gt;&lt;!-- #wrapper --&gt;
  
  &lt;div class="slide-out-div"&gt;
          &lt;a class="handle" href="http://link-for-non-js-users"&gt;Content&lt;/a&gt;
          &lt;h1&gt;Your Contact Information&lt;/h1&gt;
      &lt;form method="post" action="thankyou.php" name="myForm"  onsubmit="return(validate());"&gt; 
         &lt;label&gt;First Name &lt;/label&gt;
         &lt;input name="fname" class="text" type="text" /&gt;
         &lt;label&gt;Last Name &lt;/label&gt;
          &lt;input name="lname" class="text" type="text" /&gt;
          &lt;label&gt;Phone &lt;/label&gt;
          &lt;input name="phone" class="text" type="text" /&gt;
          &lt;label&gt;Email &lt;/label&gt;
          &lt;input name="email" class="text" type="text"/&gt;
          &lt;label&gt;City &lt;/label&gt;
          &lt;input name="city" class="text" type="text"  /&gt;
  
          &lt;input name="submit" class="submit" type="submit" value="" /&gt;
         &lt;/form&gt;
      &lt;/div&gt;
  &lt;?php 
  error_reporting(E_ALL);
  ob_start();
  if(isset($_POST['submit'])) {
  
  //include validation class
  
  //assign post data to variables
  
  $title= ""; // storing the phone number    
  
  $fname = trim($_POST['fname']); // Storing username
  
  $lname = trim($_POST['lname']); // Storing username
  
  $phone= trim($_POST['phone']); // storing the phone number
  
  $email = trim($_POST['email']); // Storing email address
  
  $city= trim($_POST['city']); // storing the phone number
  
  
  
  
  
  if(empty($fname) &amp;&amp; empty($phone) &amp;&amp; empty($email))
  
  {
  
  echo "All fields are compulsory";
  
  }
  
  $subject = "Contacted by ". $fname;
  $subject1 = "Reply From Test2014! ";
  $emailTo = 'test@test.com'; //Put your own email address here
  
          $body = "First Name: $fname \n\nLast Name: $lname \n\nPhone:\n $phone \n\nEmail: $email \n\nCity: $city" ;
          $headers = 'From: My Site &lt;'.$emailTo.'&gt;' . "\r\n" . 'Reply-To: ' . $email;
                  $headers1 = 'From: Test 2014 &lt;'.$email.'&gt;' . "\r\n" . 'Reply-To: ' . $email;
  
                  $body1 ="Dear Sir/Madam, \n\n\n;
  
  
  
          mail($emailTo, $subject, $body, $headers);
                  mail($email, $subject1, $body1, $headers1);
          $emailSent = true;
                  $conn = mysql_connect("localhost", "root", "****");
                  if (!$conn) {
      echo "Unable to connect to DB: " . mysql_error();
      exit;
  }
  
  if (!mysql_select_db("aurevoir_db")) {
      echo "Unable to select mydbname: " . mysql_error();
      exit;
  }
  mysql_select_db("aurevoir_db", $conn);
  
  
  $sql = "INSERT INTO `aurevoir_db`.`contact` (`title`, `fname`, `lname`, `phone`, `email`, `city`, `timestamp`) VALUES ('$title', '$fname', '$lname', '$phone', '$email', '$city', NOW())";
  
  mysql_query($sql) or die('Error, insert query failed' . mysql_error());
  
  $url = "thankyou.html";
  header('Location: '.$url);
  exit();
  }
  
  ?&gt;
          &lt;?php 
  
          ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The emails and DB insertion is going perfect only the page is not redirected.</p>