mysql
Dave asked:


I’ve got a form setup which accepts text via a textfield, here the user can type whatever and insert spacing and new paragraphs. The text and whatever formatting is present is saved correctly to the MySQL database, but when displaying it via PHP it displays everything on a single line.

Is there a way around this to display it as it was originally entered?

Comments

shanos111 on 21 March, 2008 at 10:01 am #

when you store into a database, the return character is usually represented as \n, but in html you need a br tag

so with a quick line of php

echo str_replace(”\n”, “< br / >“, $row['field_name']);
//This line replaces invisible endline char for tags

hopefully this make sense
If it don’t work, try substituting \n for \r


Post a Comment
Name:
Email:
Website:
Comments: