title: Sanitize query string in PHP
body: <p>I have a webpage with a query string.</p>
  
  <p>In PHP I have:</p>
  
  <pre><code>$querystring=$_SERVER["QUERY_STRING"];
  echo "&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;
  &lt;a href='index.php?$querystring'&gt;test&lt;/a&gt;
  &lt;/body&gt;&lt;/html&gt;";
  </code></pre>
  
  <p><strong>Do I need to sanitize the querystring?</strong><br>
  If yes, how do I sanitize and what are some possible attacks if I don't?</p>