title: PHP Cannot modify header information - headers already sent by
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1793482/php-error-cannot-modify-header-information-headers-already-sent">PHP error: Cannot modify header information – headers already sent</a><br>
    <a href="https://stackoverflow.com/questions/8028957/headers-already-sent-by-php">Headers already sent by PHP</a>  </p>
  </blockquote>
  
  
  
  <p>This is my code:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
      &lt;?php
  
      if($country_code == 'US')
      {
          header('Location: http://www.test.com');
      }
  
      else 
      {
          header('Location: http://www.test.com/');
      }
  
      ?&gt;
  
  &lt;script language="JavaScript" type="text/javascript"&gt;&lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>No space before <code>&lt;?php</code> or after <code>?&gt;</code></p>
  
  <p>I have tried placing the HTML code and Javascript below the PHP altogether but then that would make it not track clicks to the page.</p>