blueman378 Posted March 21, 2008 Share Posted March 21, 2008 hi guys, well im not sure if it belongs here but i want to be able to do it in php, anyway i was wondering how would i go about when you press enter in the textbox it adds a new line, thats a normal thing to happen, but this isnt sent to the form as input so if i had some content some more it would read as some content some more, how would i make it so that when there are enters it reads them to, i was using javascript before to simply insert a newline thing but that looked ugly and am wondering if there is a better way?, same as how phpfreaks does it is what im looking for Link to comment https://forums.phpfreaks.com/topic/97202-enter-key-replacement/ Share on other sites More sharing options...
Jeremysr Posted March 21, 2008 Share Posted March 21, 2008 It's the same thing happens when writing HTML, pressing enter won't cause line breaks when you view the page in a browser. You have to change the line breaks to <br />. PHP has a function for this called nl2br. It takes 1 string as an argument and returns the same string with newlines changed to <br />'s. Link to comment https://forums.phpfreaks.com/topic/97202-enter-key-replacement/#findComment-497374 Share on other sites More sharing options...
blueman378 Posted March 21, 2008 Author Share Posted March 21, 2008 thanks perfect Link to comment https://forums.phpfreaks.com/topic/97202-enter-key-replacement/#findComment-497385 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.