Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Mar 2004
    Location
    Jackson, Georgia
    Posts
    102
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HTML entities problem

    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.
    Designer's Toolz; Web & software development community.

    Get your coding questions answered:
    DTZ Forums

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I suppose you have magic_quotes turned on

    http://www.php.net/manual/en/ref.inf...quotes-runtime

    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)
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #3
    Regular Coder
    Join Date
    Mar 2004
    Location
    Jackson, Georgia
    Posts
    102
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That'll do thanks.
    Designer's Toolz; Web & software development community.

    Get your coding questions answered:
    DTZ Forums


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •