Ok everybody, I've got a real problem here, is someone could help me out with all, or just part of it, I'd be great full.
I run a website that contains HTML tutorials. I've got it set up so I can type the tutorial in to a text area box and it will be added to a database. Because it's an HTML tutorial, I run htmlspecialchars() on it before it's inserted into the database so all HTML characters will display on the users browser. After I run htmlspecialchars(), I run ereg_replace("\r\n\r\n", "\n<P>", $body) ($body is the string that contains the tutorial) on it so I can turn all the double line breaks into a <p>. Note that because I do this after htmlspecialchars() the <p>'s that it puts in will be interpreted as normal html.
The problem comes in when I try to edit the tutorial. When the tutorial is pulled from the database back into a text area box, all the <p>'s that the ereg_replace("\r\n\r\n", "\n<P>", $body) put in when it was added show up. Then, when I update the tutorial, htmlspecialchars() turns those <p>'s into something that will display in the users browser and ereg_replace() adds more <p>'s !
Can anyone help me out?
Thank you!