turkman Posted February 28, 2010 Share Posted February 28, 2010 I am getting input from a user an i protect is like the following function protect($val){ $val = mysql_real_escape_string($val); $val = htmlentities($val); $val = trim($val); return $val; } say for example i enter <p>html?</p> Then when i extract it from the database and print it too my webpage i get <p>html? </p> im just looking to show the formatting but not actually use the html if you get my point. Link to comment https://forums.phpfreaks.com/topic/193616-help-with-htmlentites/ Share on other sites More sharing options...
siwelis Posted February 28, 2010 Share Posted February 28, 2010 Is htmlentities a necessity? I wonder if htmlspecialchars may be most fitting. Link to comment https://forums.phpfreaks.com/topic/193616-help-with-htmlentites/#findComment-1019290 Share on other sites More sharing options...
turkman Posted February 28, 2010 Author Share Posted February 28, 2010 i don't know if its necessary - it worked on another site i made a year ago but i havent done any php in a while, im trying to get back into it and im wondering why when i use htmlentities it converts to <p>html? </p> but when i pull it from the database and put it back onto the webpage it stays as <p>html? </p> how can i get it to show the html formatting without actually doing anything. Link to comment https://forums.phpfreaks.com/topic/193616-help-with-htmlentites/#findComment-1019350 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.