title: How can I properly escape HTML form input default values in PHP?
body: <p>Given the following two HTML/PHP snippets:</p>
  <pre><code>&lt;input type=&quot;text&quot; name=&quot;firstname&quot; value=&quot;&lt;?php echo $_POST['firstname']; ?&gt;&quot; /&gt;
  </code></pre>
  <p>and</p>
  <pre><code>&lt;textarea name=&quot;content&quot;&gt;&lt;?php echo $_POST['content']; ?&gt;&lt;/textarea&gt;
  </code></pre>
  <p>what character encoding do I need to use for the echoed <code>$_POST</code> variables? Can I use any built-in PHP functions?</p>
  <p>Please assume that the <code>$_POST</code> values have not been encoded at all yet. No magic quotes - no nothing.</p>