title: PHP redirect with URL variables
body: <p>I'm very new to php and trying to build a redirect which uses parameters from a URL which will differ from person to person.</p>
  
  <p>The URL a person will access looks like: www.website1.com/redirect.php?p=<strong>p123</strong>&amp;r=<strong>4</strong>&amp;s=<strong>567</strong></p>
  
  <p>The p, r, and s will change for each person</p>
  
  <p>I then want to redirect them to some other site that looks like this:</p>
  
  <p>www.website2.com/<strong>p123</strong>.aspx?r=<strong>4</strong>&amp;s=<strong>567</strong></p>
  
  <p>Here is what I have so far, but it's giving me an error "Cannot modify header information - headers already sent by ..."</p>
  
  <pre><code>&lt;html&gt;
     &lt;?php
  
        $fpvalue  = $_GET['p'];
        $frvalue  = $_GET['r'];
        $fsvalue  = $_GET['s'];
  
        header("Location: http://website2.com/".$fpvalue.".aspx?r=".$frvalue."&amp;s=".$fsvalue);
  
  
     ?&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I would really appreciate the help for a beginner. </p>
  
  <p>Thanks!</p>