smc Posted January 27, 2007 Share Posted January 27, 2007 Hello,In making my CMS I discovered that when I try to submit a textfield it will not carry in the line breaks (ie. Return Lines, Enter Lines, Paragraph lines). How can I make it so the script will translate the line brakes into <br>?Thanks!! Link to comment https://forums.phpfreaks.com/topic/35917-solved-including-line-breaks/ Share on other sites More sharing options...
emehrkay Posted January 27, 2007 Share Posted January 27, 2007 is it from a text area? if so, it stores the returns as new lines. php has a built in function, nl2br() that will convert those new lines to html breaks <br /> Link to comment https://forums.phpfreaks.com/topic/35917-solved-including-line-breaks/#findComment-170321 Share on other sites More sharing options...
smc Posted January 27, 2007 Author Share Posted January 27, 2007 Yup that did it, thanks! Link to comment https://forums.phpfreaks.com/topic/35917-solved-including-line-breaks/#findComment-170329 Share on other sites More sharing options...
smc Posted January 27, 2007 Author Share Posted January 27, 2007 I just encountered a new kind of problem associated with it.Is there any way to convert tabs into readable references? Link to comment https://forums.phpfreaks.com/topic/35917-solved-including-line-breaks/#findComment-170345 Share on other sites More sharing options...
kenrbnsn Posted January 27, 2007 Share Posted January 27, 2007 You could replace the tabs with a certain number of non=breakable spaces, but you may not like the results.[code]<?php$str = str_replace("\t",' ',$str);?>[/code]The bigger question is why are you using the tab characters for formatting?Ken Link to comment https://forums.phpfreaks.com/topic/35917-solved-including-line-breaks/#findComment-170355 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.