ravix76 Posted May 28, 2007 Share Posted May 28, 2007 I'm coding an Admin interface which uses the nl2br command to preserve <br>'s on entered text. I then have an edit function which pulls up the saved text into an editable text box (for editting by the admin if that makes sense?). Problem is that when the save text is displayed, it shows the <BR>'s as text (which is fine) but then when saved again, it doubles up on all the <BR>'s. Is there a kind of reverse NL2BR command that I can use to display the saved text so the admin doesn't see the <BR>'s as text? Or, as ever with PHP, is there an easier way? Cheers Rav Quote Link to comment https://forums.phpfreaks.com/topic/53278-stripping-s/ Share on other sites More sharing options...
redarrow Posted May 28, 2007 Share Posted May 28, 2007 the only way in the admin form is to delete the <br and press submit or they will double with using the nl2br ok. Quote Link to comment https://forums.phpfreaks.com/topic/53278-stripping-s/#findComment-263283 Share on other sites More sharing options...
kenrbnsn Posted May 28, 2007 Share Posted May 28, 2007 The nl2br() function should only be used when you're displaying the stored text. It should never be used when storing text or you will run into the problem you're seeing. Ken Quote Link to comment https://forums.phpfreaks.com/topic/53278-stripping-s/#findComment-263290 Share on other sites More sharing options...
ravix76 Posted June 5, 2007 Author Share Posted June 5, 2007 Solved thanks to the above. I don't use nl2br for storing. I don't use nl2br for recalling into an editable text form box I do use nl2br for displaying the text as HTML. Love the feeling of solving a bug! Quote Link to comment https://forums.phpfreaks.com/topic/53278-stripping-s/#findComment-268742 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.