View Full Version : Line breaks

11-14-2007, 08: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.


11-14-2007, 08: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

11-15-2007, 03: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.

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

11-15-2007, 07: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.

11-15-2007, 12: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..

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

11-15-2007, 06: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

11-16-2007, 09:47 AM
yes thats right

nl2br will replace \n with <br>

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

That helped heaps