There are all around dozens of PHP Blog tutorials. Inside these tutorials, a BlogPost object is used to represent a new post of the blog. Typically, the BlogPost has a text field that store the body of the new post. Of course, a form is used to get the text from inside a textbox in a Web page.
Usually, a post entry is divided in paragraphs that are delimited by a line break. When the text is acquired through a POST action sent by the form of the Web page, it is stored in a database (MySQL in my case).
When the new post is retrieved by the DB and then it is displayed in a Web page, all the line breaks are not shown. Of course, each single paragraph should be rendered by recurring to the proper HTML tag.
How to handle this problem with MySQL and PHP5, both from the entry side and the rendering side?
Thanks in advance.
PS: I think that this problem is essentially simple, so let me excuse for the question. However, I also recognize that it is common to many problems (blog, online news paper, forum, etc.).
There are several editors you can use, such as TinyMCE, which solve this problem for you. The user appears to be entering text in a nice text editor, but behind the scenes the field is being populated with the html required to render that text.