I have this textfield in a html form, which I want to insert into my MySQL database using php.
But, I want the typed text to get HTML formatting, so I can easily display it on my website.
How can I do this?
The row where it should be inserted into the MySQL database is of the type: text.
The reason I want to know this, is because normally a textfield doesnt output linebreaks…
IF you want to have the newlines, use the PHP function
nl2br()so you will get the new lines.If any HTML is typed into that box. you will get it.
However, I recommend not storing the
<br>orHTML tags you add manuallyto the database, but do it later. Thenl2br()function should be called after you get it from the database.Documentation: http://www.php.net/manual/en/function.nl2br.php