Friday, July 4, 2008

Saving Textarea value with enter / Line feed / Line break in PHP

In save forms into database... the value in the text area cant be saved with the line feed that user gives.

To get them we can use the following function...

consider the textarea name is description.... then we can convert the line feed in the form of '\n' or '\r' into <br />

$desc = $_REQUEST['description'];
$desc = ereg_replace("(\r\n|\n|\r)", "<br />", $_desc);


Cheers!

No comments: