> Hi, > > If I have a html textarea for inputting text into a database text field > how can I keep the formatting of the entered text? > > i.e. on the html textarea if the user enters carriage returns i.e. a new > paragraph I want that to go into the database then when I retrieve it and > display it on a normal html page I want to keep those carriage returns! > > Thanks > > Matt
Before injecting textarea data into a DB use this: $_POST["textarea"] = str_replace("\n","<br>",$_POST["textarea"]); When retrieving data from the DB for a textarea use this before displaying: $_POST["textarea"] = str_replace("<br>","\n",$_POST["textarea"]); -- --Matthew Sims --<http://killermookie.org> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php