php safe output
<p>Im trying to make a "remember fields" thingy so if theres one error you wont 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 ads alot of //////</p>

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

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