I have a text area in which press releases are made, when copying and pasting the text into the textarea field the paragraphs are preformatted to have breaks inbetween them, yet when submitted to the db, and pulled back out of the db on a seperate page, the breaks don't show up and the text is shown as one big block.
I have to manually put in the <BR> after each paragraph, is there a way to get the field to automatically make those breaks? I know it can be done. On deviantart.com when putting info into a text field, if you hit return twice it is parsed as 2 <BR><BR>'s
automatically parsing new lines
Moderator: General Moderators
-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact:
of course, anything with PHP!
u'll have to do a little replacing when u get from the database...here's the code i use:
u'll have to do a little replacing when u get from the database...here's the code i use:
Code: Select all
<?php $listquery = "SELECT * FROM forum where forumname="general"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) {
$message = $rowї"msg"];
їb]$search = array("/\n/");
$replace = array("<br>\n");
$message = preg_replace($search, $replace, $message);
echo $message;ї/b]
} ?>-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact: