limitphp Posted November 14, 2008 Share Posted November 14, 2008 I have a textarea that people use to add comments. If they type for example: test test2 It will show up as: test test2 How do you keep the line break in between the two so it shows up as: test test2 Thanks Link to comment https://forums.phpfreaks.com/topic/132745-solved-line-breaks-in-textarea/ Share on other sites More sharing options...
flyhoney Posted November 14, 2008 Share Posted November 14, 2008 nl2br http://us.php.net/nl2br Link to comment https://forums.phpfreaks.com/topic/132745-solved-line-breaks-in-textarea/#findComment-690324 Share on other sites More sharing options...
limitphp Posted November 14, 2008 Author Share Posted November 14, 2008 awesome..... thank you. Link to comment https://forums.phpfreaks.com/topic/132745-solved-line-breaks-in-textarea/#findComment-690331 Share on other sites More sharing options...
plodos Posted November 14, 2008 Share Posted November 14, 2008 could you tell me how did you solve this problem? please share sample code pls. also I need this but I didnt apply nl2br function:s Link to comment https://forums.phpfreaks.com/topic/132745-solved-line-breaks-in-textarea/#findComment-690335 Share on other sites More sharing options...
flyhoney Posted November 14, 2008 Share Posted November 14, 2008 could you tell me how did you solve this problem? please share sample code pls. also I need this but I didnt apply nl2br function:s Here is a simple demo of how it could be used: <?php if ($_POST['action'] == 'Go Go Go') { $text = nl2br($_POST['foo']); // now do whatever you want with text, insert it into a database or display it to the user } ?> <html> <form method="post" action=""> <textarea name="foo"></textarea> <input type="submit" name="action" value="Go Go Go" /> </form> </html> Link to comment https://forums.phpfreaks.com/topic/132745-solved-line-breaks-in-textarea/#findComment-690339 Share on other sites More sharing options...
plodos Posted November 14, 2008 Share Posted November 14, 2008 its easy now thank you Link to comment https://forums.phpfreaks.com/topic/132745-solved-line-breaks-in-textarea/#findComment-690347 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.