stevenreid Posted December 15, 2007 Share Posted December 15, 2007 I've a facility where a site owner submits text that is saved into a csv from a textarea. When it is read back from the csv I have the problem of any returns being read in as \r\n\r\n I tried a character str_replace and I've read up a bit on the problem but none of the solutions I've found have seemed to work for me. $thisStoryStory = $thisStory[2]; $thisStoryStoryB = str_replace(array("\r\n\r\n", "\r\n", "\r", "\n"), "<br />",$thisStoryStory); echo "<p>".$thisStoryStoryB."</p>"; was what I used and I thought should have worked fine but I still get audience up for a great time.\r\n\r\nClick the link below to Cheers. Link to comment https://forums.phpfreaks.com/topic/81765-reading-paragraph-returns-from-form-text/ Share on other sites More sharing options...
PHP_PhREEEk Posted December 15, 2007 Share Posted December 15, 2007 Use nl2br on the string... PhREEEk Link to comment https://forums.phpfreaks.com/topic/81765-reading-paragraph-returns-from-form-text/#findComment-415351 Share on other sites More sharing options...
stevenreid Posted December 15, 2007 Author Share Posted December 15, 2007 yes I tried that to no avail echo "<p>".nl2br($thisStoryStory)."</p>"; didn't do anything Link to comment https://forums.phpfreaks.com/topic/81765-reading-paragraph-returns-from-form-text/#findComment-415355 Share on other sites More sharing options...
phpSensei Posted December 15, 2007 Share Posted December 15, 2007 What are you trying to do? Remove all that str_replace stuff, and just use echo nl2br($thisStory[2]); Link to comment https://forums.phpfreaks.com/topic/81765-reading-paragraph-returns-from-form-text/#findComment-415360 Share on other sites More sharing options...
stevenreid Posted December 15, 2007 Author Share Posted December 15, 2007 again - new line to break echo nl2br($thisStory[2]); or echo nl2br($thisStoryStory); doesn't work at all Could the server's version of PHP have anything to do with it? what about the page encoding? I've tried UTF and ISO Link to comment https://forums.phpfreaks.com/topic/81765-reading-paragraph-returns-from-form-text/#findComment-415381 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.