title: Header location not working on live server but works on localhost
body: <p>Header location not working on live server but works on localhost.</p>
  
  <p>This code worked until last week, but it does not work anymore.</p>
  
  <p>So, I have started testing on localhost. It is working as before.</p>
  
  <p>I tried to add "ob_start()" on the top of the code; not working.</p>
  
  <p>Please review this code and comment.</p>
  
  <pre><code>&lt;?php session_start();
  $fnameErr ="";
  $lnameErr ="";
  $emailErr ="";
  $phoneErr = "";
  $dateErr = "";
  $timeErr = "";
  $errMsg = "";
  
  $area = "";
  $local3 = "";
  $local4 = "";
  
  $cust_info = "";
  
  $charOnly = "/^[a-z]+[a-z]$/i";
  $reg_email = "/^[^0-9~!@#$%^&amp;*()_+=?.,][a-z0-9_]+([.][a-z0-9_]+)*[@][a-z0-9_]+([.][a-z0-9_]+)*[.][a-z]{2,3}$/i";
  $reg_phone = "/^(\d{3}+\d{3}+\d{4}|\d{3}\d{3}+[\s]{1}+\d{4}|\d{3}+[\s]{1}+\d{3}+[\s]{1}+\d{4}||\d{3}+[-]{1}+\d{3}+[-]{1}+\d{4}|\d{3}+[\s]{1}+\d{7}|\(\d{3}\)\s{1}\d{3}[\s-]{1}\d{4})$/";/*"/^(\d{3}|[(]\d{3}[)]|\d{3}[)])[ -]*\d{3}[ -]*\d{4}$/";*/
  
  $dataValid = true;
  
  $phone = $area .''. $local3 .''. $local4;
  $phoneValid = true;
  // If submit with POST
  if ($_POST) { 
      $errMsg = "Debugging";
      $area = $_POST['c_area'];
      $local3 = $_POST['c_local3'];
      $local4 = $_POST['c_local4'];
  
      $cust_info = array( "first" =&gt; $_POST['c_fname'], 
                    "last" =&gt; $_POST['c_lname'], 
                    "email" =&gt; $_POST['c_email'], 
                    "phone" =&gt; array("area"=&gt; $area,
                                      "mid" =&gt; $local3,
                                      "last" =&gt; $local4), 
                    "date" =&gt; $_POST['c_date'], 
                    "time" =&gt; $_POST['c_time']);
       // Test for nothing entered in field
      if ($_POST['c_fname'] == "") {
          $fnameErr = "Please enter your first name.";
          $dataValid = false;
      }
      else {  
          if ( preg_match($charOnly, $_POST['c_fname']) ) 
          {
              $fnameErr = "";
          } else {
              $fnameErr = "This is an invalid name.";
              $dataValid = false;
          }
      }
      if ($_POST['c_lname'] == "") {
          $lnameErr = "Please enter your last name.";
          $dataValid = false;
      }
      else {  
          if ( preg_match($charOnly, $_POST['c_lname']) ) 
          {
              $lnameErr = "";
          } else {
              $lnameErr = "This is an invalid name.";
              $dataValid = false;
          }
      }
      if ($_POST['c_email'] == "") {
          $emailErr = "Please enter E-mail address.";
          $dataValid = false;     
      }
      else {  
          if ( preg_match($reg_email, $_POST['c_email']) ) 
          {
              $emailMsg = "";
          } else {
              $emailMsg = "E-mail is not Valid.";
              $dataValid = false;
          }
      }
      if ($_POST['c_area'] == "") {
          $phoneErr = "Please enter phone number.";
          $dataValid = false; 
          $phoneValid = false;    
      }
      if ($_POST['c_local3'] == "") {
          $phoneErr = "Please enter phone number.";
          $dataValid = false;     
          $phoneValid = false;    
      }
      if ($_POST['c_local4'] == "") {
          $phoneErr = "Please enter phone number.";
          $dataValid = false;     
          $phoneValid = false;    
      }
      if( $phoneValid ) {
          $phone = $area . "" . $local3 . "" .$local4;        
          if ( preg_match($reg_phone, $phone) ) {
              $phoneErr = "";
          } else {
              $phoneErr = "Phone number is not Valid.";
              $dataValid = false;
          }
      } else {
          $area = "";
          $local3 = "";
          $local4 = "";
          $phone = "";
  
      }
      if ($_POST['c_date'] == "") {
          $dateErr = "Please choose a date.";
          $dataValid = false;     
      }
      if ($_POST['c_time'] == "" || $_POST['c_time'] == "Morning" || $_POST['c_time'] == "Afternoon") {
          $timeErr = "Please choose a time.";
          $dataValid = false;
      } else {
          if ("07:00" == $_POST['c_time']){
              $Checked0700 = 'selected';
          }  
          else if ("07:30" == $_POST['c_time']){
              $Checked0730 = 'selected';
          }  
          else if ("08:00" == $_POST['c_time']){
              $Checked0800 = 'selected';
          } 
          else if ("08:30" == $_POST['c_time']){
              $Checked0830 = 'selected';
          } 
          else if ("09:00" == $_POST['c_time']){
              $Checked0900 = 'selected';
          }
          else if ("09:30" == $_POST['c_time']){
              $Checked0930 = 'selected';
          } 
          else if ("10:00" == $_POST['c_time']){
              $Checked1000 = 'selected';
          } 
          else if ("10:30" == $_POST['c_time']){
              $Checked1030 = 'selected';
          } 
          else if ("11:00" == $_POST['c_time']){
              $Checked1100 = 'selected';
          } 
          else if ("11:30" == $_POST['c_time']){
              $Checked1130 = 'selected';
          } 
          else if ("12:00" == $_POST['c_time']){
              $Checked1200 = 'selected';
          } 
          else if ("12:30" == $_POST['c_time']){
              $Checked1230 = 'selected';
          } 
          else if ("13:00" == $_POST['c_time']){
              $Checked1300 = 'selected';
          } 
          else if ("13:30" == $_POST['c_time']){
              $Checked1330 = 'selected';
          } 
          else if ("14:00" == $_POST['c_time']){
              $Checked1400 = 'selected';
          } 
          else if ("14:30" == $_POST['c_time']){
              $Checked1430 = 'selected';
          } 
          else if ("15:00" == $_POST['c_time']){
              $Checked1530 = 'selected';
          } 
          else if ("15:30" == $_POST['c_time']){
              $Checked1530 = 'selected';
          } 
          else if ("16:00" == $_POST['c_time']){
              $Checked1600 = 'selected';
          } 
          else if ("16:30" == $_POST['c_time']){
              $Checked1630 = 'selected';
          } 
          else if ("17:00" == $_POST['c_time']){
              $Checked1700 = 'selected';
          } 
          else if ("after" == $_POST['c_time']){
              $Checkedafter = 'selected';
          } 
      }
  }
  
  if ($_POST &amp;&amp; $dataValid) { 
  
  
      $_SESSION['token1'] = "ok";
      $_SESSION['cust'] = $cust_info;
  
      header('Location:innout-booking-step2.php');
      exit();
  ?&gt;
  </code></pre>