Infected.Shadow Posted December 28, 2008 Share Posted December 28, 2008 Okay so I haven't written any code for this yet. I would also like to apologize if I'm not communicating this thoroughly. I'm finding it hard to describe the problem at hand. My problem is this: Say a user enters this into a text field: This is a line! This line is lower! Now on most sites I've been to, it would output like that on the page. When I go to try this in my code it always ends up coming out like this: This is a line! This line is lower! So usually I'm pulling these values from a database, so I'm wondering if there is a function in php that will keep the same formatting the user wants (Spaces, line skips, etc.). Any help would be greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/138601-solved-formatting-text-through-php/ Share on other sites More sharing options...
JasonLewis Posted December 28, 2008 Share Posted December 28, 2008 nl2br restores line breaks from data that is stored in MySQL. If you want to restore spaces and everything you should use CSS and change the white-space property. Quote Link to comment https://forums.phpfreaks.com/topic/138601-solved-formatting-text-through-php/#findComment-724704 Share on other sites More sharing options...
Infected.Shadow Posted December 28, 2008 Author Share Posted December 28, 2008 nl2br restores line breaks from data that is stored in MySQL. If you want to restore spaces and everything you should use CSS and change the white-space property. This is exactly what I was looking for! Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/138601-solved-formatting-text-through-php/#findComment-724705 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.