title: Header location is not working on live server
body: <p>I Have one registration and payment page. program flow is like registration > confirmation > payment. After validation and calculation in registration page need to go to confirmation page.<br>
  My code is </p>
  
  <pre><code>&lt;?php
  ob_start();
  session_start();
  
  include("header.php");
  include("ini.php");
  date_default_timezone_set('Asia/Brunei');
  header('Cache-Control: max-age=900');
  
  if (isset($_POST['submit'])) {
      $error = 0;
  //validations
  
  if ($error &lt;= 0) { 
  //do some calculation
  header('location:confirm.php');
  }
  }
  &lt;?php
  ob_flush();
  ?&gt;
  </code></pre>
  
  <p>Control entered in to if ($error &lt;= 0) clause, but stay on the registration page.</p>
  
  <p>I tried many ways like </p>
  
  <pre><code> header('location:confirm.php', true, 302);
  </code></pre>
  
  <p>instead of </p>
  
  <pre><code>header('location:confirm.php');
  </code></pre>
  
  <p>removed </p>
  
  <pre><code>ob_start() and ob_flush()
  
  
  
  add exit() after  header()
  </code></pre>
  
  <p>then it goes to blank page.</p>
  
  <p>Also try to use</p>
  
  <pre><code>echo '&lt;script type="text/javascript"&gt;';
          echo 'window.location.href="confirm.php";';
          echo '&lt;/script&gt;';
  </code></pre>
  
  <p>Then the control goes to confirmation page but url seems to be as registration.php </p>
  
  <p>But header('location:confirm.php'); is working fine in my local server. Anybody please help me to resolve this issue.. Is there any alternate way for header(). Looking forward to you guys.. Thanks</p>