Reputation: 3361
I have a comment box that users can fill and saving the text in a MySQL database:
When a users fills text in my textbox with a backslash (\n)
it shows in the text box without the new line.
For example, the user enters:
Hi everyone!
Me
The Textbox displays:
Hi Everyone!Me
What am I doing wrong?
Upvotes: 0
Views: 1725
Reputation: 424
try this : when extracting from database use this :
str_replace("\n",'<br />',$databasefield)
it`s working for me:)
Upvotes: 0
Reputation: 112895
Use Environment.NewLine
instead of "\n
" (or at least "\r\n
", since this is what Environment.NewLine
contains on non-Unix platforms anyway).
Also, make sure your TextBox
's MultiLine
property is set to true
.
myTextBox.MultiLine = true;
myTextBox.Text = "hi," + Environment.NewLine + "ALL";
Upvotes: 5