i have a form where a user submits text. for example a text field and they submit: hello, my name is so and so. thank you. it's inserted into the db like that, but when its displayed it comes out as: hello, my name is so and so. thank you. all on the same line. how do i make it so that it keeps its format as it is in db.? would i have to have it insert <br> tags after each line? if so how would i do that?
on my submit form that inserts it into the db or should that go to my output form that actually shows the data?
also, there is no \n or anything in the record in the db. it's automatically input with spaces and line breaks in the database. just that when it goes to display it on the display page it's all jumbled up on one line.
it works, but i need to to insert it into the db the <br> tag... if i use that function it adds a double space to all existing records that already have the br tag.
Before inserting into databse, use nl2br function and then insert! So $_POST['fieldname'] will become nl2br($_POST['fieldname'])
There is another way that would handle it client side... use white-space: pre; - just be warned that you lose wordwrap.