Page 1 of 1

CR Returns entered in webform don't reflect in echoed string

Posted: Wed Apr 16, 2003 10:59 am
by 3dron
I am using something similiar to

echo ereg_replace(" ","<p>",$row_test('review'));

to add a <p> at "3 spaces" in a string stored in a database.

This string is entered by a web form that I wan't users just to hit return to have it show when the string is echoed back out.

Why do "returns" not show when echoed out? In the database the "return" exists.

Is there any other character I can replace (one that represents the return) with ereg_replace? or another easier way?

Posted: Wed Apr 16, 2003 11:31 am
by twigletmac
The easiest way is to use nl2br() on the output. This will add HTML break tags (<br />) next to line break characters (\n).

Mac