title: PHP redirection in between
body: <p>I want to do redirect from my login page to the display profile page, but I don't know how to do it. Many suggested the concept of</p>
  
  <pre><code>header('Location: $location');
  </code></pre>
  
  <p>but its working only in the beginning part of the code. What if we want to forward it after confirming the username and password?</p>
  
  <p>How about this?</p>
  
  <pre><code>echo"&lt;html&gt;&lt;?php header('location:www.google.com'); ?&gt;&lt;/html&gt;";
  </code></pre>