I am displaying data from an sql database in a textarea which will be altered by the user then re-submitted to the database.
The problem is displaying a line break. I get <br /> displayed in the textarea rather than the newline.
Can anyone help?
That means that the data entered into the database had a <br /> in it (and <br /> is the code for a line break). It is VERY likely that your input script is first converting the newline into a <br /> then inserting it into the databsae.
What I do is input the content unaltered, but when it comes to displaying it on a web page, via php, I run the only bits that will have newlines through the php function nl2br() - see the manual. nl2br() produces a <br />, so what I actually did just recently was write my own function to make it insert <br> instead, just to keep the validation tool happy and to exercise my brain. (Because I don't use xhtml, as it is a dead-end and most browsers can't read it, so they convert it to html first!) I don't run it through the function when it is displayed in a textarea for editing, however. So no <br />, just the newline.