![]() |
[SOLVED]what happens to textarea content when inserted to the db? - 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: [SOLVED]what happens to textarea content when inserted to the db? (/showthread.php?tid=18367) |
[SOLVED]what happens to textarea content when inserted to the db? - El Forum - 05-04-2009 [eluser]bobbob[/eluser] I am having an odd problem where some outputted textarea breaks my marker code in google maps. It appears that using nl2br() doesn't remove the \n properly Code: var marker = createMarker(point,"<div style=\"width:400px height:450px\"><?php echo $loc; ?><br><?php echo nl2br($description); ?><br></div>"); I have plyed with htmlentities and str_replace with no luck [SOLVED]what happens to textarea content when inserted to the db? - El Forum - 05-04-2009 [eluser]simshaun[/eluser] Is the data coming from a database? If so, have you done anything to the data before you inserted it into the db? [SOLVED]what happens to textarea content when inserted to the db? - El Forum - 05-04-2009 [eluser]bobbob[/eluser] I was doing an xxs_clean but i bypassed that to see hwhat happened and the same ting happens. firebug shows: unterminated string literal var marker = createMarker(point,"<...:400px height:450px\">ddd<br>dddd<br />\n [SOLVED]what happens to textarea content when inserted to the db? - El Forum - 05-04-2009 [eluser]simshaun[/eluser] Is your data delimited by \r\n or just \n? I could be wrong, but I believe nl2br only converts \r\n. [SOLVED]what happens to textarea content when inserted to the db? - El Forum - 05-04-2009 [eluser]drewbee[/eluser] Try this: Code: var marker = createMarker(point,'<div style="width:400px height:450px"><?php echo $loc; ?><br><?php echo str_replace("'", "\'",nl2br($description)); ?><br></div>'); [SOLVED]what happens to textarea content when inserted to the db? - El Forum - 05-04-2009 [eluser]bobbob[/eluser] Tried the last example and no luck with str_replace() Also I am on a mac. I think that does alter the \n [SOLVED]what happens to textarea content when inserted to the db? - El Forum - 05-04-2009 [eluser]bobbob[/eluser] Solved it with this function from someone else: Code: <?php <?php echo removeLineBreaks($description); ?> |