CodeIgniter Forums
[Problem solved] How to echo Line Feed? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: [Problem solved] How to echo Line Feed? (/showthread.php?tid=52850)



[Problem solved] How to echo Line Feed? - El Forum - 06-29-2012

[eluser]solid9[/eluser]
When I try to save this paragraph into database below for example,
Code:
This is line one.
This is line two.

This is line three.
This is line four.

And try to echo it,
It convert into this below,
Code:
This is line one. This is line two.This is line three.This is line four.

meaning it's not echoing the original format.

So how do I echo the original format with line feed and spacing?
Also How do I make it so It will accept HTML tags as well aside from pure text only.

Thanks in advanced.




[Problem solved] How to echo Line Feed? - El Forum - 06-29-2012

[eluser]Rayhan[/eluser]
Try Rich Text Format


[Problem solved] How to echo Line Feed? - El Forum - 06-29-2012

[eluser]Dan Storm[/eluser]
Use the nl2br() function - this automatically changes \n to
Code:
<br>
.

Quote:Also How do I make it so It will accept HTML tags as well aside from pure text only.

You need to aloborate this - a simple textarea/textfield can recieve any kind of input.


[Problem solved] How to echo Line Feed? - El Forum - 06-29-2012

[eluser]solid9[/eluser]
Thanks guys.

Problem solved.