Problem with MySQL Text field

1

I'm having a hard time storing a simple text field in my DB. I have the following textarea:

<textarea class="txtarea" rows="4" cols="50" name="Text" id="txt_area_post" value="" placeholder="Insira uma descrição detalhada."></textarea>

It looks like it's pretty simple, when I store the text in BD, it's all in one line.

In the BD the field is of type TEXT.

I would also like a help where someone could show me the correct way to store a large text, with validation of empty spaces, in short, the correct way to store and the solution to this error. I'm grateful for the help!

    
asked by anonymous 14.03.2017 / 20:02

1 answer

1

In the Database the characters of line breaks and spaces are retained, but if you are playing in HTML you have to somehow store the break formatting as paragraphs or blank lines:

<p>Paragrafo de exemplo</p> <br />

As you yourself put in the comet, the error occurred because you threw the text in the HTML, and in it the text will be printed as "RAW Text".

As you have already discovered the text can be displayed inside a

<textarea readonly>
Seu texto aqui 
</textarea>

for displaying line breaks and spaces.

    
15.03.2017 / 13:34