OK, I have read all the threads here about addslashes(), stripslashes() and the evil magic_quotes. Well here it goes again, with a little twist!

I have bbcode on my site in the form of [link="URLGOESHERE"]my site[/link]. Now, I run addslashes() (without magic_quotes on (Dr. Pepper would be proud )) before I put the data in mysql. When extracting it, I run htmlspecialchars() then I replace the [link] tags, etc. However, I get (changed the URL, so the forum wouldn't mess it up):
PHP Code:
<a href="&quot;URLGOESHERE&quot;" target="_blank">my site</a
! Not good. Anyone have an idea?