mga_ka_php Posted March 20, 2007 Share Posted March 20, 2007 how do i input textarea value to mysql database that will preserve the format? ex. if i input a text in textarea ---------------------------------- line one line two ---------------------------------- and transfer it to mysql database and retreive it the text will look like this ---------------------------------------------------- line one line two ---------------------------------------------------- it will not put it to the next line. thank you. Quote Link to comment Share on other sites More sharing options...
AndyB Posted March 20, 2007 Share Posted March 20, 2007 Put it in the database exactly the way you're doing. When you retrieve it, use the nl2br() function to turn new lines into html br tags: echo nl2br($databasetext); 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.