CodeIgniter Forums
how to use nl2br on form_textarea - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: how to use nl2br on form_textarea (/showthread.php?tid=18204)



how to use nl2br on form_textarea - El Forum - 04-28-2009

[eluser]yudahebat[/eluser]
I want to know how we use nl2br on form_textarea??
so when we input some text on it and we press ENTER it became a newline or
Code:
<br />
so on database its save as :
Code:
some text <br />
some text

not

Code:
some text some text

please help me


how to use nl2br on form_textarea - El Forum - 04-28-2009

[eluser]Thorpe Obazee[/eluser]
[quote author="yudahebat" date="1240997441"]
so on database its save as :
Code:
some text <br />
some text

not

Code:
some text some text

please help me[/quote]
You shouldn't use nl2br unless you're outputting it on the web page and not a textarea. About the saving part(saving the &lt;br /&gt; in the database). I don't get why you need it there, any reason for it?


how to use nl2br on form_textarea - El Forum - 04-28-2009

[eluser]yudahebat[/eluser]
what should I use?? I have news DB , on admin I put the news through form_textarea
on webpage I want display it
so when I put the news on form_textarea when I press ENTER it became <br />


how to use nl2br on form_textarea - El Forum - 04-28-2009

[eluser]Thorpe Obazee[/eluser]
[quote author="yudahebat" date="1240997858"]what should I use?? I have news DB , on admin I put the news through form_textarea
on webpage I want display it
so when I put the news on form_textarea when I press ENTER it became <br />[/quote]

As I said in my other reply, when you're outputting on the webpage, you can use the nl2br(). You can also use, auto_typography()


how to use nl2br on form_textarea - El Forum - 04-28-2009

[eluser]yudahebat[/eluser]
I mean if the user use the admin area on the form_textarea they dont need to type
Code:
<br />
.
they just typing and when the want make a newline they just press Enter
how we make it?? what we usa to make that? nl2br??


how to use nl2br on form_textarea - El Forum - 04-28-2009

[eluser]Thorpe Obazee[/eluser]
[quote author="yudahebat" date="1240999513"]I mean if the user use the admin area on the form_textarea they dont need to type
Code:
<br />
.
they just typing and when the want make a newline they just press Enter
how we make it?? what we usa to make that? nl2br??[/quote]

You don't need to type in '&lt;br /&gt;'.


how to use nl2br on form_textarea - El Forum - 04-29-2009

[eluser]Zeeshan Rasool[/eluser]
before using or echo value in view
use:

Code:
echo nl2br($textarea_value);

Keep going