aquatsr Posted September 14, 2006 Share Posted September 14, 2006 I have some text in a TEXT attribute field in my database, and it's inputed like: ParagraphParagraphParagraph However when I get the $data from the field and do echo ("$data");I get: ParagraphParagraphParagraph How do I make sure there are the line breaks in the correct places? Link to comment Share on other sites More sharing options...
justsomeguy Posted September 14, 2006 Share Posted September 14, 2006 Use the nl2br function to convert newline characters to <br /> tags:echo nl2br($input); Link to comment Share on other sites More sharing options...
murfitUK Posted September 14, 2006 Share Posted September 14, 2006 I've been fiddling about with this today and think I've cracked it!Instead ofecho($data);tryecho nl2br($data);That the letters NL (just to clarify as the l can look like i or 1 | etc).You got in there quick justsomeguy! Link to comment Share on other sites More sharing options...
justsomeguy Posted September 15, 2006 Share Posted September 15, 2006 That is the ninja way. Link to comment Share on other sites More sharing options...
Cronthenoob Posted September 15, 2006 Share Posted September 15, 2006 That is the ninja way. :ph34r: Link to comment Share on other sites More sharing options...
aquatsr Posted September 15, 2006 Author Share Posted September 15, 2006 Ahhh, thanks! Exactly what I was looking for! I also had to stripslash() the data. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now