Forum Moderators: coopster

Message Too Old, No Replies

formatting database text output

         

dkin

5:00 pm on Jun 29, 2005 (gmt 0)

10+ Year Member



If I have a text column in my database, and a simple text box that enters the value how can I have it formatted the same way I enter it when I call it on my page?

sned

5:10 pm on Jun 29, 2005 (gmt 0)

10+ Year Member



If you mean having the line breaks in the same places, look at nl2br [us4.php.net]

-sned

dkin

5:33 pm on Jun 29, 2005 (gmt 0)

10+ Year Member



I mean I want to insert something like this.

This is paragraph one

Hi Im paragraph two

Hooray for numero 3

and have it come out like this

<p>This is paragraph one</p>

<p>Hi Im paragraph two</p>

<p>Hooray for numero 3</p>

Does this make any sense?

dkin

7:36 pm on Jun 29, 2005 (gmt 0)

10+ Year Member



Anyone?

sned

7:45 pm on Jun 29, 2005 (gmt 0)

10+ Year Member



I'm not sure how you would add <p> and </p> around text, but the nl2br function will give you the lines as you have entered them in, just like you would type in this textarea to enter a message.

Two lines down ....

3 ...

etc.

But if you really needed the <p></p>, you might be able to do something with str_replace [us3.php.net]