PDA

View Full Version : Echoing out text



Romanity
18-02-2007, 07:51 PM
Oki, so i enter text in a form.. a textarea, like below:


Hi
My name is lewis

blah blah

It inserts it into the database, but when it echos it back out, it echos it as


HiMy name is lewisblah blah

how do i stop this from happening and have the breaks work when echoed out.

ZAG
18-02-2007, 08:10 PM
Before inserting it into the database, replace the linebreak with <br>

e.g.

$data = eregi_replace("\n", "<br>", $data);

Romanity
18-02-2007, 08:18 PM
Thankies =]

nets
18-02-2007, 11:30 PM
Or use the nl2br (http://php.net/nl2br) function.

Want to hide these adverts? Register an account for free!