![]() |
|
[PHP] alternative to htmlspecialchars without losing html tags.?? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183) +---- Thread: [PHP] alternative to htmlspecialchars without losing html tags.?? (/showthread.php?tid=5787780) |
alternative to htmlspecialchars without losing html tags.?? - Fiend - Jan 20, 2018 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. RE: alternative to htmlspecialchars without losing html tags.?? - RumbleFrog - Jan 21, 2018 Why are you using htmlspecialchars if you want to preserve their meaning in the HTML scheme? RE: alternative to htmlspecialchars without losing html tags.?? - SIM-1073426 - Jan 22, 2018 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? RE: alternative to htmlspecialchars without losing html tags.?? - Fiend - Jan 23, 2018 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() |