Collin.Arner Posted February 7, 2010 Share Posted February 7, 2010 Hey guys, I'm looking to get some help with PHP. I'm pretty new, but I can't find an answer or solution to my problem. "Test Test Test" The above is saved to a MySQL database. It shows up fine if I echo it into a <textarea> box, but if I just use echo inside of a <p> tag it shows up Test Test Test Is there any way to display the text properly? Thanks in advance, -Collin Link to comment https://forums.phpfreaks.com/topic/191226-echo-doesnt-display-spaces/ Share on other sites More sharing options...
bouba Posted February 7, 2010 Share Posted February 7, 2010 The text is printed properly; it's just that browsers don't render the newline character (unless when inside <textarea>). To render it you need to use the php function nl2br which transforms newlines to <br> tags. Link to comment https://forums.phpfreaks.com/topic/191226-echo-doesnt-display-spaces/#findComment-1008273 Share on other sites More sharing options...
Collin.Arner Posted February 7, 2010 Author Share Posted February 7, 2010 Thank you so very much! You just saved me a ton of headache! Link to comment https://forums.phpfreaks.com/topic/191226-echo-doesnt-display-spaces/#findComment-1008277 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.