PDA

View Full Version : Line breaks


neonfluxx
11-14-2007, 09:04 AM
Do any of you guys know if an extension or a script that will enter line breaks in to the database when the person hits enter.

The problem:

I enter information and hit enter to create a new line. It looks right in the database fields but when it displays it is all one paragraph. I have entered the <br> tag but that really sucks to have to type that. Is there a way to do that automatically when pressing enter. perhaps and extension or a script.

Thanks,

edbr
11-14-2007, 09:49 AM
funny you should ask that I have just added 'tinymice' to the admin section of one of my sites so i have a text editor when adding or changing records, this worked for me

neonfluxx
11-15-2007, 04:10 AM
I don't think that will work for me. As users will be adding information too thanks though. Hey DJ you dont have a script for this.

edbr
11-15-2007, 07:01 AM
don't think thats a problem it can be configured to work on any form text area

Cary
11-15-2007, 08:33 AM
A PHP book of mine suggests using the nl2br() function when retrieving the text from the database. However, if the nl isn't being stored to begin with, then this won't help.

domedia
11-15-2007, 01:42 PM
PHP has a function for inserting <br>'s from linebreaks so you DB will have the right formatting.. then you don't have to use nl2br when outputting. Can't remember what it's called though..

neonfluxx
11-15-2007, 07:06 PM
Could you please remember domedia, this is driving me nuts lol

domedia
11-15-2007, 07:39 PM
actually it's nl2br as well when inserting into DB, just asked a collegue. I guess you choose when to add the BR's, when entering into DB or retrieving

davidj
11-16-2007, 10:47 AM
yes thats right

nl2br will replace \n with <br>

neonfluxx
11-18-2007, 05:16 AM
Thanks dm and dj.

That helped heaps