jcanker Posted August 25, 2007 Share Posted August 25, 2007 Is there a php string function that will preserve the line breaks that a user enters into a <textarea> on a form? I've been manually using <p> or <BR> in the textarea, and now that I'm opening up the form to other users, I can't rely on them using it. These forums are able to do it....how is it done? Link to comment https://forums.phpfreaks.com/topic/66598-solved-how-to-preserve-line-breaks-in-input/ Share on other sites More sharing options...
Fadion Posted August 25, 2007 Share Posted August 25, 2007 u mean nl2br() ?? Link to comment https://forums.phpfreaks.com/topic/66598-solved-how-to-preserve-line-breaks-in-input/#findComment-333677 Share on other sites More sharing options...
jcanker Posted August 25, 2007 Author Share Posted August 25, 2007 I suppose.... Does that preserve when the user hits enter to move to the next line, or does nl2br only work if /n is entered? Link to comment https://forums.phpfreaks.com/topic/66598-solved-how-to-preserve-line-breaks-in-input/#findComment-333678 Share on other sites More sharing options...
Fadion Posted August 25, 2007 Share Posted August 25, 2007 When the user presses a enter in a textarea, a newline is generated. To correctly display the newlines in html, u need to convert them to BRs, so nl2br() will do it. Link to comment https://forums.phpfreaks.com/topic/66598-solved-how-to-preserve-line-breaks-in-input/#findComment-333683 Share on other sites More sharing options...
jcanker Posted August 25, 2007 Author Share Posted August 25, 2007 Cool.. thank you! Link to comment https://forums.phpfreaks.com/topic/66598-solved-how-to-preserve-line-breaks-in-input/#findComment-333685 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.