title: php header("location: test.php") not working. But java script redirect working
body: <pre><code>php header("location: test.php")
  </code></pre>
  
  <p>not working. But java script redirect working .</p>
  
  <p>I tried with <code>header()</code> doesn't redirects?</p>
  
  <pre><code>header("location: test.php");
  </code></pre>
  
  <p>but i tried with java script its working</p>
  
  <pre><code>window.location ="http://www.test.com/test.php"
  </code></pre>
  
  <p>what is the problem. please give some solution</p>
  
  <p>before calling header there no echo ( output commands )</p>
  
  <p>there is no error / warning messages</p>
  
  <p>My exact code :</p>
  
  <pre><code>if($contlogin &gt;0 &amp;&amp; $LoginID!="")
  {      
      $_SESSION['LoginID'] = $LoginID;
      if($_SESSION['currentUrl']) {
          header("location: http://".$_SESSION['currentUrl']);
      }
      else {
          if($LoginID==1) {
              header("location:admin/index.php");
          }
          else {
              header("location:dashboard.php");
          }
      }
  }
  else {   
      header("location:index.php?err=1");
  }
  </code></pre>