jeff5656 Posted October 18, 2012 Share Posted October 18, 2012 When a user enters data into a text box, I want to retain those carriage returns. Therefore I use nl2br. The problem is that when they go to edit the data again, another carriage returns is added. How do I 1. allow carriage returns in a text box and 2. avoid duplicate carriage returns, which the nl2br solution will do? here's the code: <form> <textarea name="medications" value = <?php echo nl2br(stripslashes($rpw['meds']));?></textarea> Link to comment https://forums.phpfreaks.com/topic/269623-nl2br-posting-duplicate-carriage-returns/ Share on other sites More sharing options...
trq Posted October 18, 2012 Share Posted October 18, 2012 nl2br appends <br> tags after newline characters so you do NOT wont to use it when displaying data in a textarea. Why don't you post your actual code? Link to comment https://forums.phpfreaks.com/topic/269623-nl2br-posting-duplicate-carriage-returns/#findComment-1385954 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.