I like to use urlencode() and urldecode() to store strings temporarily. That way I don't have to think about double-quotes, quotes, ampersands, newlines or tabs or in fact anything.
Two caveats:
The academics will point out that it performs worse, and I would respond by saying that more time is wasted thinking about it than dealing with it, since it's a PHP website and not a particle accelerator. (Or is it?)
You have to urldecode() it when you're going to show it.
PLEASE NOTE that for the problem you describe, urlencode()/urldecode() would be overkill. I only mentioned this for future reference, but in your particular case, the escaping is far more appropriate as described in the accepted solution.