On Thursday 04 October 2001 06:48, Neil Silvester wrote:
> Currently I am using a standard <TEXTAREA></TEXTAREA> field for information
> input to the MySQL database. When I display the allready information in the
> text fields to allow the user to manipulte the information, the formatting
> includes any carrige returns that have been entered. However when I display
> the text using the mysql_fetch_array the returns are no more, and instead
> are only displayed as a single space between the next word. I know this is
> due to the way that HTML reads whitespace, but how can I force the
> formatting of the text so it is displayed how the user intended.
> I have tried to use ADDSLASHES() to reformatt the variables befofe entering
> them into the tables, but I am unsure if this is the right method. And if
> so, how can I convert the \n to <br>?
> I am not sure if this is a question that I should be asking to this
> maillist or not, but I thought I would give it a shot.

Well, why not? It is actually not a MySQL problem, because MySQL is
faithfully reproducing the data input,and not a PHP problem, 
because PHP should be passing the text with carriage returns to the
browser, and it is not a browser problem, because as you say
this is the way carriage returns are usually treated in HTML.

There are two solutions: either convert the carriage returns 
in the text for display on the fly in PHP into <br>s;
or use <pre></pre> around the text in question, as this will
display it exactly as intended.

It would not be a good idea to convert the \n to <br>
before insertion into the database, because these will
then appear in any <textarea> fields.



HTH 
Ian Barwick

-- 
Ian Barwick - Developer - [EMAIL PROTECTED]
akademie.de asp GmbH - http://www.akademie.de

"To query tables in a MySQL database is more fun than eating spam"

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to