Results 26 to 27 of 27
Thread: Edit Error
Apr 16, 2006, 15:04 #26
- Join Date
- Apr 2006
- Wirral, UK
- 0 Post(s)
- 0 Thread(s)
I presume you're running the nl2br before you're saving the information in the table? The trouble is once you start doing this you need to realise that every new line will be assigned a br tag. All you are doing is saving the text being run through the nl2br, but I'm presuming you're not running the content through a function like br2nl beforehand (no the function doesn't exist but you get the idea). So on each save the br tags are being added, but on each retrieval they're not being removed, but save again, and the tags will most likely double up. You're assuming the content is saved with no br tags, the trouble is after the first save they have the br tags in place.
the best option is to remove the nl2br and either
1. always save your reviews with (x)html displayed and just display the output and allow your html to control it
2. use nl2br on the front end when retrieving the information, not when saving the information.
Alternatively write a function to strip out the <br />s before displaying the text in your edit form, then when you resave it will save them back in.
Apr 17, 2006, 12:57 #27
how can i use nl2br on the front end in the xhtml code?