[Beds] new line problem

Lee Larcombe lee at larcombe.uk-internet.org.uk
Mon Sep 1 12:22:01 2003


Hi

I'm hoping someone will be able to help with this problem...

I have a database which contains several text fields, entered via a web 
form. The datatype is MySQL TEXT. When the data is typed into the form 
it is submitted by a perl cgi script. The data is stored in the 
database correctly, and  can search and retrieve it ok.

The problem is this..

The text is typed in with paragraphs. When I view the data from mysql 
at the command line, the output retains its paragraph structure - 
similarly via phpMyAdmin. When I read the data back into a web form 
textarea to edit and resubmit the text it also retains its paragraphs.

However when I output it amongst other html ie;

<table>
<tr><td>Here is some text: $text</td></tr>
</table>

where $text is the content of the database field, the text is displayed 
as a block with no paragraphs.

I have tried using something like:  s/\n/<br>/g to replace newlines 
with html breaks which works when I manually add \n's to the text, but 
doesn't recognise 'hidden' new line characters.

Does anyone have any idea how to achieve this?

Thanks
Lee


=========================================
Larcombe IT - total computing technology solutions

www.larcombe.uk-internet.org.uk