Problem with Mysql Text field

Asked

Viewed 159 times

1

I am having a hard time storing a simple text field in my BD. 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>

Apparently it’s something very simple, when I store the text in the comic book, it’s all in one line.

In BD the field is of type TEXT.

I would also like a help where someone can 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 your help!

  • Do you need it to keep empty spaces and line breaks only? Or will it have other formatting like bold and italics?

  • 1

    George, I was having a really stupid problem, but because I myself was an ahuahuahuah big head, I was throwing the value of the bank into a div instead of arrow the textarea directly. I did it and solved it, and I put it as readonly.

  • I was going to comment on this later, in BD is kept the spaces and line breaks, but if you are playing in HTML you have to find a way to store the breaks formatting of it <p><br> etc... I think you can answer your question yourself and choose as the answer.

1 answer

1


In the Database the line break characters and spaces are maintained, 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 put it yourself, the error occurred because you threw the text into 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 the display of line breaks and spaces.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.