I am having trouble getting around new line characters. I store a textarea field into a db then pull it back out and into a javascript array along with other descriptions. However when some one puts a hard return into the textarea the db stores it fine but it kills my javasctipt array.
Any thoughts.
php, newlines and javascript arrays
Moderator: General Moderators
depends on what you want to do with the text.
i.e. with http://www.php.net/manual/en/function.str-replace.php you can get rid of the \r,\n signs or replace them by something appropriate.
there's also a function called nl2br() but it will not replace \r\n, it prepends a <br/> - probably not not solving your problem
i.e. with http://www.php.net/manual/en/function.str-replace.php you can get rid of the \r,\n signs or replace them by something appropriate.
there's also a function called nl2br() but it will not replace \r\n, it prepends a <br/> - probably not not solving your problem