php safe output
<p>I'm trying to make a "remember fields" thingy, so if there is one error you won't have to fill in the whole form again. But how can I make the output safe?</p>

<p>Example:</p>

<pre><code>&lt;input type="text" name="email" value="&lt;?php echo (isset($_POST['email'])) ? htmlspecialchars($_POST['email']) : ''; ?&gt;" /&gt;
</code></pre>

<p>If someone types in " ' " (without the quotes) for example you get:</p>

<pre><code>Warning: mysql_result() expects parameter 1 to be resource, boolean given in C:\wamp\www\pages\register.php on line 55
</code></pre>

<p>So then I tried:</p>

<pre><code>&lt;input type="text" name="email" value="&lt;?php echo (isset($_POST['email'])) ? mysql_real_escape_string($_POST['email']) : ''; ?&gt;" /&gt;
</code></pre>

<p>Then it just adds a lot of //////.</p>

<p>What should I do?</p>

<p>I'm a noob yes. But I thought htmlspecialchars made user input safe?</p>
