Reputation: 11471
I have a textarea in html that gets saved to a mysql table using PHP. What the user writes in this text area could look like this
1. Follow this directions
First buy some wood, then get a hammer.
2. Blah blah
so when it saves to the database it just saves is as it is.. the problem is when I retrieve this data it would look like this (I am putting it in a <p> </p>
1. Follow this directions First buy some wood, then get a hammer. 2. Blah blah
But I do not want to display it like that, I want to preserve the way the user enters it.. how can i do this?
Thank you
Upvotes: 0
Views: 389
Reputation: 23858
The newlines should be stored in mysql - you could wrap it in <pre></pre>
tags which will tell the browser that the text is pre-formatted. And then stop the html white space cleaning which is causing your issue
Upvotes: 1