View Full Version : HTML entities problem

04-01-2004, 08:15 PM
I am using this code to stop parsing of posted code on my forum:

$threadd = str_replace("&lt;br /&gt;","<br/>",htmlspecialchars(nl2br($thread)));

Works great. Untill someone posts a single quote.

Example of the problem:

user posts: don't
post comes out as: don\'t

Same with double quotes.

Whats up with this?

Thanks. :cool:

04-01-2004, 08:21 PM
I suppose you have magic_quotes turned on


If so, then turn it off or use a stripslashes() on every output

(If you ask me, magic_quotes are probably the most stupif thing ever added to PHP. You never know what setting another host will have and it can realy mess up your script)

04-01-2004, 08:27 PM
That'll do thanks.