I recently encountered an issue when adding text to my MySQL database using a textarea. The format of the text, including newlines and spaces, was saved in the database but not displayed as such when viewed directly. When I retrieve this string from the database and load it into a textarea again, the original format is preserved. However, when attempting to display this string in a div element, it appears as one continuous line.
My query is: How can I display formatted text correctly in a div element?