Re: Retaining formatting problem
| From: | David Robley | Date: | Tue, 08 Jul 2003 13:28:30 +0000 |
| Subject: | Re: Retaining formatting problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-154353@lists.php.net to get a copy of this message | ||
In article <20030708092957.E02FE9481C@adm3.sa.schools.net.au>,
brenton@lefevrehs.sa.edu.au says...
> Hello everyone,
>
> I have a long running problem that i just want to get covered, I have a standard text box for
> people to insert long lengths of text.
>
> This text box is in a standard <input type="text"> but when I insert it into
> the database the line returns dissapear, eg
>
> "this
>
> little amount of
>
> text"
>
> will enter like
>
> "this little amount of text will enter like"
>
> Please help me it is p!!$$!ng me right off :P
>
> Cheers in advance
Mate, newlines in HTML are treated as whitespace, so all the newlines will
be faithfully stored in your database and faithfully ignored by your
browser when you display the contents of the database :-) Look at 'View
Source' and you will see the new lines in the source. You want to feed the
output from your database to nl2br() to add some <BR /> tags so browsers
will recognise the line breaks.
May I recommend you tell Outhouse to wrap lines at around 74 characters
for mail lists/newsgroups?
[Lefevre - down in the direction of Semaphore or the Port?]
Cheers
--
Quod subigo farinam