Page 1 of 1

stupid question ...

Posted: Wed Aug 24, 2005 3:46 pm
by TheColdWinterAir
I have a lyrical website that i'm having problems getting something to work correctly,

When i have lyrics submitted to the database, the line breaks are correctly entered into the database without me having to put <br> after each line. However when i try to display the $lyrics variable on the site it puts the lyrics (which should be in poetry form) into paragraph form

i.e:

If i submit something like -
Roses Are Red
Violets Are Blue

The display on the site becomes
Roses Are Red Violets are Blue

Any way to fix this?

Posted: Wed Aug 24, 2005 3:49 pm
by John Cartwright

Posted: Wed Aug 24, 2005 3:52 pm
by shiznatix
html does not use \n as a line break so you have to change any \n as a <br> but the best way would be as jcart said as that nl2br which basically does that changing \n to a <br> but it might be better if you just put all of the \n as a <br> in the database first off becuase it might just make everything a bit easier

Posted: Wed Aug 24, 2005 3:56 pm
by Stewsburntmonkey
It would certainly be more efficient that way. :)

Posted: Wed Aug 24, 2005 4:02 pm
by shiznatix
tell us how you end up doing everything for the knowledge of the rest :D