knaj11 Posted March 31, 2010 Share Posted March 31, 2010 i have a text area which is values is stored to mysql after being submitted, i then get the value of the text area from mysql using PHP-post. . now the problem is that the content of my text area are lyrics... it was inputted like this in the text area, and it should look like this after retrieving from mysql.. "Imagine a dirt road full of potholes With a creek bank and some cane poles catchin channel cat I'm a little more country than that" unluckily, it will result to this after retrieving... "Imagine a dirt road full of potholes With a creek bank and some cane poles catchin channel cat I'm a little more country than that" how should i format that??? help please Quote Link to comment Share on other sites More sharing options...
trq Posted March 31, 2010 Share Posted March 31, 2010 What are you doing to the data on the way into the database? You shouldn't need to do anything special to achieve the effect your after, it would seem your somehow stripping the newline chars out. Quote Link to comment Share on other sites More sharing options...
knaj11 Posted March 31, 2010 Author Share Posted March 31, 2010 i have a form which contains a text area. i got a problem on how to format what has been entered in the text area. sample they input paragraphs(well usually) but once they submit the text area it won't save in the correct format. Like how would i let it know that they started a new line and have it automatically enter a <p> tag or whateveer.. Quote Link to comment Share on other sites More sharing options...
JustLikeIcarus Posted March 31, 2010 Share Posted March 31, 2010 Well one way you could do this is prior to displaying the text as html replace occurances of "\n" with "</br>". In this situation "\n" will be where the user started a new line. Quote Link to comment Share on other sites More sharing options...
knaj11 Posted March 31, 2010 Author Share Posted March 31, 2010 got it already. just need the nl2br function. thanks people. Quote Link to comment 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.