CodeIgniter Forums

Full Version: Textarea
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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?

El Forum

[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();
    }
}

El Forum

[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

El Forum

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

InsiteFX