EchoFool Posted June 23, 2008 Share Posted June 23, 2008 I have 2 questions about outputs of which I do not know how to fix. Firstly, say a user inputs a paragraph that they decided to use <Span class=whatever>Words etc</span> How can you stop upon output the class being called so it will just be "Words etc" but not changed the words colour or what ever from a span class that it reads? And secondly say a user inputs a paragraph again with some thing like: This isn't fair! When i input this i use the : mysql_real_escape_string For safety, but then the ouput for it will become: This isn/'t fair! Link to comment https://forums.phpfreaks.com/topic/111530-solved-2-questions-about-outputs/ Share on other sites More sharing options...
trq Posted June 23, 2008 Share Posted June 23, 2008 1/ strip_tags(). 2/ No it won't. Not unless you have magic_quotes_gpc enabled and if that is the case, simply use stripslashes() prior to calling mysql_real_escape_string(). Link to comment https://forums.phpfreaks.com/topic/111530-solved-2-questions-about-outputs/#findComment-572447 Share on other sites More sharing options...
EchoFool Posted June 24, 2008 Author Share Posted June 24, 2008 So it would be: For my first Q: echo nl2br(strip_tags($str)); And for my second Q: stripslashes(mysql_real_escape_string($str)); Link to comment https://forums.phpfreaks.com/topic/111530-solved-2-questions-about-outputs/#findComment-573184 Share on other sites More sharing options...
trq Posted June 24, 2008 Share Posted June 24, 2008 Indeed. Link to comment https://forums.phpfreaks.com/topic/111530-solved-2-questions-about-outputs/#findComment-573186 Share on other sites More sharing options...
EchoFool Posted June 24, 2008 Author Share Posted June 24, 2008 Thankyou Link to comment https://forums.phpfreaks.com/topic/111530-solved-2-questions-about-outputs/#findComment-573187 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.