Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

PHP 

alternative to htmlspecialchars without losing html tags.??

alternative to htmlspecialchars without losing html tags.??

for example 

I echo code with php on this line

echo htmlspecialchars($Names['ads']);

but htmlspecialchars strips tags so outputs following.

<p style="text-align: center;"><strong>testttttttttttttttttttttttttttttt</strong></p>


How would i go about securing my php code without losing my tags?


I guess this is impossible after my searching's. still haven't found anything.


Can anyone help with this.
Why are you using htmlspecialchars if you want to preserve their meaning in the HTML scheme?
...
You seem a bit confused, the purpose of the htmlspecialchars function is to prevent HTML code from rendering by showing the html entities value instead. There for your HTML code is isn't being executed by design of the function. If you want to allow certain HTML tags you can use strip_tags?
i meant as in the term i was using htmlspecialchars() on php echo statement but because i was storing html tags in db because i use TinyMCE editor. i just ended up using this htmlspecialchars_decode()


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Javascript]  by flexing_99Apr 29, 2023 12:02 AM 3 269 Apr 29, 2023 12:02 AM
Last Post: Zgh600
[Javascript]  by flexing_99Jul 4, 2020 04:11 PM 0 131 Jul 4, 2020 04:11 PM
Last Post: flexing_99
[Javascript]  by AreWeRealApr 6, 2020 02:22 AM 5 214 Apr 6, 2020 02:22 AM
Last Post: AreWeReal