Jump to content

Recommended Posts

I am retrieving text and HTML tags from a database while using this function to encode the values for the browser.



foreach ($row as $key => &$value){
    $value = htmlspecialchars_decode(
                 htmlentities($value,ENT_QUOTES),
                 ENT_NOQUOTES
             );
}

Basically, I am looping through each row and converting quotes, single quotes, and other special characters to entities while keeping HTML tags.


However, when there's tags like 



<a href="example.com">

the quotes are duplicated twice and outputs to this:



<a href=""example.com"">

What am I doing wrong?


Link to comment
https://forums.phpfreaks.com/topic/279573-htmlentities-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.