mum4d Posted March 17, 2006 Share Posted March 17, 2006 I have a form that puts text into a MySql database. The text can contain carrage returns to create paragraphs.When I echo the text into a text area, all looks OK.BUTWhen I echo the text direct, the line breaks do not work and everything appears in one line.How do I echo the text so it appears correctly, including line breaks, without placing in in a text area tag???Example:-this works[code]<textarea name="textfield" cols="70" rows="12"><?php echo $row_Recordset1['Description']; ?></textarea>[/code]this don't work[code]<?php echo $row_Recordset1['Description']; ?>[/code]Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/5153-a-stupid-newbie-question/ Share on other sites More sharing options...
webwiese Posted March 17, 2006 Share Posted March 17, 2006 Hi,nl2br($yourtext) transaltes linebreaks into <br>. Quote Link to comment https://forums.phpfreaks.com/topic/5153-a-stupid-newbie-question/#findComment-18308 Share on other sites More sharing options...
mum4d Posted March 17, 2006 Author Share Posted March 17, 2006 [!--quoteo(post=355888:date=Mar 17 2006, 10:44 AM:name=webwiese)--][div class=\'quotetop\']QUOTE(webwiese @ Mar 17 2006, 10:44 AM) [snapback]355888[/snapback][/div][div class=\'quotemain\'][!--quotec--]Hi,nl2br($yourtext) transaltes linebreaks into <br>.[/quote]Thanks Webwiese, works exactly how I want.Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/5153-a-stupid-newbie-question/#findComment-18309 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.