npsari Posted April 19, 2007 Share Posted April 19, 2007 I have a Text area users type text on it, then click submit The text is saved in the database But all the "Enters" are gone! i.e. when the user clicks enter to go to the next line, this, doesnt show when I echo the Text from the database it all shows in the same line Why is this happening Quote Link to comment https://forums.phpfreaks.com/topic/47756-solved-al-the-enters-are-gone-results-show-on-the-same-line/ Share on other sites More sharing options...
MadTechie Posted April 19, 2007 Share Posted April 19, 2007 without seeing any code i would guess you did something thing wrong try nl2br($data) Quote Link to comment https://forums.phpfreaks.com/topic/47756-solved-al-the-enters-are-gone-results-show-on-the-same-line/#findComment-233254 Share on other sites More sharing options...
npsari Posted April 19, 2007 Author Share Posted April 19, 2007 I use the normal retreive code echo $row['Description']; and all the enters are gone try nl2br($data) <--- what is this, is it the retreive code? Quote Link to comment https://forums.phpfreaks.com/topic/47756-solved-al-the-enters-are-gone-results-show-on-the-same-line/#findComment-233260 Share on other sites More sharing options...
anthylon Posted April 19, 2007 Share Posted April 19, 2007 nl2br = new line to <br> . All enters should be converted to html tag <br> = new line. using nl2br() <?php echo nl2br("foo isn't\n bar"); ?> this will output : foo isn't<br /> bar Quote Link to comment https://forums.phpfreaks.com/topic/47756-solved-al-the-enters-are-gone-results-show-on-the-same-line/#findComment-233263 Share on other sites More sharing options...
kenrbnsn Posted April 19, 2007 Share Posted April 19, 2007 The function nl2br() inserts a "<br />" tag before each newline character in a string, so you want to do: <?php echo nl2br($row['Description']); ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/47756-solved-al-the-enters-are-gone-results-show-on-the-same-line/#findComment-233265 Share on other sites More sharing options...
npsari Posted April 19, 2007 Author Share Posted April 19, 2007 thanks guys for the nl2br I never knew about it Now, we are good friends thanks Quote Link to comment https://forums.phpfreaks.com/topic/47756-solved-al-the-enters-are-gone-results-show-on-the-same-line/#findComment-233267 Share on other sites More sharing options...
anthylon Posted April 19, 2007 Share Posted April 19, 2007 We are good friends now? I thought we are friends all the time... Sure we all are friends. We are helping each other and that's good.. Best wishes from Bosnia Quote Link to comment https://forums.phpfreaks.com/topic/47756-solved-al-the-enters-are-gone-results-show-on-the-same-line/#findComment-233505 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.