CodeIgniter Forums
how to change ENTER into <br /> on form_textarea?? - 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: how to change ENTER into <br /> on form_textarea?? (/showthread.php?tid=18172)

Pages: 1 2


how to change ENTER into <br /> on form_textarea?? - El Forum - 04-27-2009

[eluser]yudahebat[/eluser]
I want to know if I press ENTER on form_textarea, it became to
Code:
<br />
how we make it??
so when we save it into the database it became to like this :

- line 1
- line 2
- line 3

NOT like this:
- line 1 - line 2 - line 3

please help me..


how to change ENTER into <br /> on form_textarea?? - El Forum - 04-28-2009

[eluser]Peter Pan[/eluser]
Use the PHP Function nl2br.


how to change ENTER into <br /> on form_textarea?? - El Forum - 04-28-2009

[eluser]yudahebat[/eluser]
explain me about php function nl2br please.. I'm newbie


how to change ENTER into <br /> on form_textarea?? - El Forum - 04-28-2009

[eluser]Peter Pan[/eluser]
Very simple:
Code:
string nl2br  ( string $string  [, bool $is_xhtml= true  ] )

Returns string  with '<br />' or '<br>' inserted before all newlines.



how to change ENTER into <br /> on form_textarea?? - El Forum - 04-28-2009

[eluser]yudahebat[/eluser]
give me an example sith some text please....
sorry Im very2 newbie on PHP


how to change ENTER into <br /> on form_textarea?? - El Forum - 04-28-2009

[eluser]Bramme[/eluser]
If you're such a newbie to php you can't recognize a simple function, I suggest you first do some background reading (like PHP5 for Dummies) before even starting to fool around with CI...


how to change ENTER into <br /> on form_textarea?? - El Forum - 04-28-2009

[eluser]yudahebat[/eluser]
I just wanna example of using nl2br to continue my work on CI...
Ive learn CI for 4-5 month but I have problem on textarea
please give the example...
I dont have a time to read PHP5 for dummies
I want practice2 n practice...


how to change ENTER into <br /> on form_textarea?? - El Forum - 04-28-2009

[eluser]umefarooq[/eluser]
hi if you want to enter <br /> to you code use some wysiwyg editors like tinymce or fckeditor it will help you a lot


how to change ENTER into <br /> on form_textarea?? - El Forum - 04-28-2009

[eluser]Peter Pan[/eluser]
Look at the documentation on php.net. There are some examples.


how to change ENTER into <br /> on form_textarea?? - El Forum - 04-28-2009

[eluser]yudahebat[/eluser]
ok thx