Hi Phil,

> I have a form inserting data into a database. I'm using 
> nl2br to add <br> to the data enetered where appropriate.
> The data is then pulled out of the database and inserted 
> into text fields for editing.
> Can anyone tell me how to remove the <br> tags while 
> maintaining the line breaks in the text field?

Don't use nl2br when you're storing the data, use it when you're displaying
it.

// write data to table
$s = "INSERT INTO foo SET bar = 'some text \n with a line break'";
$q = mysql_query ($s);

// read data from table
$s = "SELECT foo FROM bar";
$q = mysql_query ($s);
$r = mysql_fetch_array ($q);
echo "this is ". nl2br ($r["foo"]);

HTH
Jon

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to