Forums

PHP

This topic is locked

Text Box LF/CR into <P> </>P ?

Posted 17 Dec 2001 21:10:52
1
has voted
17 Dec 2001 21:10:52 Stephen Bateman posted:
Hopefully someone can help me out on this.

I have a simple text box I need to be able to get users to type into.(Like this one) where when they start a new line or paragraph by pressing enter it does something to make that save in my MySQL text field. So that when I list the value via another screen you get overall format of new lines and parapgraphs.

Is it a case of somehome detecting a new line and replaceing it with <pre id=code><font face=courier size=2 id=code>&lt;P&gt; and &lt;/P&gt; </font id=code></pre id=code> or is there something really simple I am missing.

Any notes or working examples on this would be greatly appreciated.

Thanks

GT


Replies

Replied 18 Dec 2001 00:33:41
18 Dec 2001 00:33:41 Tim Green replied:
PHP has a built in function to handle this for you automatically <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>

Luckily I also built this function into PHAkT Server Formats so it is simplicity itself to apply.

All you need to do is to drop your database column onto the page from the Data Bindings floater, then with the column selected on the page go to the highlighted entry in the Data Bindings floater, and you will find a drop down menu.

In that menu, go to the Strings submenu and select the Convert \ n to &lt; BR &gt; entry and click it.

What this does is exactly what it says, it converts all line feed characters to the HTML &lt; BR &gt; tag, therefore preserving your formatting.

Hope this helps

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 20 Dec 2001 00:43:32
20 Dec 2001 00:43:32 Stephen Bateman replied:
Thanks

Worked a treat.

GT

Reply to this topic