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 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>. 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! Link to comment https://forums.phpfreaks.com/topic/5153-a-stupid-newbie-question/#findComment-18309 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.