keeps21 Posted May 20, 2009 Share Posted May 20, 2009 I have a textarea which I'm inserting into a database field. The problem I'm having is that if a user types in the textarea Line one. Line Two. Line Three. the text is stored in the database as: Line one. Line Two. Line Three. What I want is for the text to be stored as Line one. Line Two. Line Three. as it needs to be all on one line when It's output in the html source otherwise it breaks the Javascript. But I can't figure out how to. Note: There are no /n or /r tags in the database once saved. The only text is what you see above. Quote Link to comment https://forums.phpfreaks.com/topic/158891-solved-enter-textarea-into-db-without-line-breaks/ Share on other sites More sharing options...
fenway Posted May 20, 2009 Share Posted May 20, 2009 Please post the solution, even it's not mysql. Quote Link to comment https://forums.phpfreaks.com/topic/158891-solved-enter-textarea-into-db-without-line-breaks/#findComment-838099 Share on other sites More sharing options...
keeps21 Posted May 20, 2009 Author Share Posted May 20, 2009 Needed to remove invisible \n and \r before outputting did this by doing a str_replace() for each of them. Quote Link to comment https://forums.phpfreaks.com/topic/158891-solved-enter-textarea-into-db-without-line-breaks/#findComment-838103 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.