<p>I'm having a little bit of trouble making a sticky form that will remember what is entered in it on form submission if the value has double quotes. The problem is that the HTML is supposed to read something like:</p>

<pre><code>&lt;input type="text" name="something" value="Whatever value you entered" /&gt;
</code></pre>

<p>However, if the phrase: "How do I do this?" is typed in with quotes, the resulting HTML is similar to:</p>

<pre><code>&lt;input type="text" this?="" do="" i="" how="" value="" name="something"/&gt;
</code></pre>

<p>How would I have to filter the double quotes? I've tried it with magic quotes on and off, I've used stripslashes and addslashes, but so far I haven't come across the right solution. What's the best way to get around this problem for PHP?</p>

You want
htmlentities()
.
```
<input type="text" value="<?php echo htmlentities($myValue); ?>">
```