CodeIgniter Forums
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: Textarea (/showthread.php?tid=40733)



Textarea - El Forum - 04-17-2011

[eluser]kr1pt[/eluser]
Hello. When I insert data in db from textarea, with new lines: (example: data,

data), when I display it, it makes double lines every time. So:

this:
some
-new line-
-new line-
text

makes:
some
-new line-
-new line-
-new line-
-new line-
text

bug or?


Textarea - El Forum - 04-17-2011

[eluser]cmgmyr[/eluser]
Yeah, this is a bug that happens on some servers depending on your set up. To fix this just create a "MY_Input.php" file in your application/core with the following:
Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Input Extends CI_Input
{
    public function __construct()
    {
        if (PHP_EOL == "\r\n"){
            $this->_standardize_newlines = FALSE;
            log_message('debug', 'Windows server: standardize newlines disabled.');
        }
        
        parent::__construct();
    }
}



Textarea - El Forum - 04-17-2011

[eluser]kr1pt[/eluser]
I did only that, and still same error. When I try to edit that textarea string, I get that error.

Example: i have commenting system. And when I press 'edit comment', i get comment data in a textarea, and when i hit 'update', it makes double lines. :S

if you understand what i mean

when i display comment data in a textarea, i just use variable, i dont use any functions


Textarea - El Forum - 04-17-2011

[eluser]InsiteFX[/eluser]
This has already been discussed on the forums here, please do a search!

InsiteFX