title: setcookie, Cannot modify header information - headers already sent
body: <p>I am new to PHP, I practised PHP setcookie() just now and failed.</p>
  
  <p><a href="http://localhost/test/" rel="noreferrer">http://localhost/test/</a><strong>index.php</strong></p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
          &lt;title&gt;&lt;/title&gt;
  
      &lt;/head&gt;
      &lt;body&gt;
       &lt;?php
       $value = 'something from somewhere';
  
       setcookie("TestCookie", $value);
       ?&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><a href="http://localhost/test/" rel="noreferrer">http://localhost/test/</a><strong>view.php</strong></p>
  
  <pre><code>&lt;?php
   // I plan to view the cookie value via view.php
   echo $_COOKIE["TestCookie"];
  
  ?&gt;
  </code></pre>
  
  <p>But I failed to run index.php, IE warning like this.</p>
  
  <pre><code>Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\test\index.php:9) in C:\xampp\htdocs\test\index.php on line 12
  </code></pre>
  
  <p>I enabled my IE 6 cookie no doubt. </p>
  
  <p>Is there anything wrong on my procedure above? Thank you.</p>
  
  <p><em>WinXP OS and XAMPP 1.7.3 used.</em></p>