Hi 
...Having a bit of hascel with formatting paragraphs here in a content management system. I have an edit page area which requests the content from a database and puts it inside a textarea for a user to edit, but its coming up as normal html instead of the paragraphs being spaced out.
What I'm using is:
which I have got for taking the data out of the database and correctly converting it into html for viewing on a normal page, but I'm trying to reverse it so that when it's taken out of the database instead of showing the html it puts the data as normal, editable paragraphs.
I tried simply switching "\r\n" with "\n" around and the rest of them and that sort of works but instead of having 1 line between each paragraph theres 5.
Is there anything else I can do?

...Having a bit of hascel with formatting paragraphs here in a content management system. I have an edit page area which requests the content from a database and puts it inside a textarea for a user to edit, but its coming up as normal html instead of the paragraphs being spaced out.
What I'm using is:
Code:
//Convert Windows (\r\n) to Unix (\n)
$PageContent = ereg_replace("\r\n", "\n", $PageContent);
// Convert Macintosh (\r) to Unix (\n)
$PageContent = ereg_replace("\r", "\n", $PageContent);
// Handle paragraphs
$PageContent = ereg_replace("\n\n", '</p><p>', $PageContent);
// Handle line breaks
$PageContent = ereg_replace("\n", '<br />', $PageContent);
which I have got for taking the data out of the database and correctly converting it into html for viewing on a normal page, but I'm trying to reverse it so that when it's taken out of the database instead of showing the html it puts the data as normal, editable paragraphs.
I tried simply switching "\r\n" with "\n" around and the rest of them and that sort of works but instead of having 1 line between each paragraph theres 5.
Is there anything else I can do?