crazylegseddie Posted May 4, 2006 Share Posted May 4, 2006 Hi everyone, just a simple displaying problem.if I insert information using a textarea <textarea name="Notes" cols="50" rows="6" class="box"></textarea>and display information using:echo $row ['Notes'];All the data inputed remains on 1 line. Ive triedecho nl2br ($row ['Notes']); but think ive got the syntax wrong. Any help with this would be good. thank you Quote Link to comment https://forums.phpfreaks.com/topic/9046-echo-data-from-textarea-on-seperated-lines/ Share on other sites More sharing options...
wildteen88 Posted May 4, 2006 Share Posted May 4, 2006 Yes the following is the correct sytax[code]echo nl2br ($row ['Notes']); [/code]But remove the space between $row and ['Notes'] in the above code so it is just:[b]$row['Notes'][/b]Also I presume you are getting $row['Notes'] from a database? And any data that is submitted from the textarea is added into the database? Quote Link to comment https://forums.phpfreaks.com/topic/9046-echo-data-from-textarea-on-seperated-lines/#findComment-33282 Share on other sites More sharing options...
wlpywd Posted March 2, 2007 Share Posted March 2, 2007 I am having i think the same problem, and trying not to start new topics on same posts. I have a form inserting data into a mysql database, and on the page where i call the data, a simple tabled list of the data displayed, anything entered in the "textarea" box is displayed as one long sentence instead of displaying where someone typed 'enter' key. So display is like this:Jon Smith 554 main Anytown USA instead of:Jon Smith554 mainAnytown USAI have tried adding this code, with the space taken out, to my code but it does not seem to work. Is there more to it i need to do rather than whats shown here on my display page to get it to work correctly? (i am fairly new to php...)thanks anyone! Quote Link to comment https://forums.phpfreaks.com/topic/9046-echo-data-from-textarea-on-seperated-lines/#findComment-197477 Share on other sites More sharing options...
Toshiba23 Posted March 2, 2007 Share Posted March 2, 2007 try thisprint str_replace("\n", "<br>", $row['NOTES']); Quote Link to comment https://forums.phpfreaks.com/topic/9046-echo-data-from-textarea-on-seperated-lines/#findComment-197490 Share on other sites More sharing options...
wlpywd Posted March 2, 2007 Share Posted March 2, 2007 Thanks! its working! Quote Link to comment https://forums.phpfreaks.com/topic/9046-echo-data-from-textarea-on-seperated-lines/#findComment-197497 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.