MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Landy Atkinson Date:March 19 2003 5:14pm
Subject:Text formatting of articles pulled from database??
View as plain text  
I am setting u a simple article storage/retrieval system and have set 
up a MySQL database with a few VARCHAR fields for author, date, 
source and a BLOB field for article.  I have also set up two pages, 
one for editing/adding new articles and a second one for viewing the 
articles.

The adding/deleting page uses a <FORM> with <TEXTAREA> to allow 
someone to copy past the text into the "article" field.  This seems 
to work just fine and if I display the  text back in a <FORM> 
<TEXTAREA> field, formatting works as I expect.  Paragraphs are 
separated by a line of white space and the text wraps to the size of 
the <TEXTAREA>.

I am trying to display the article on a second page which is 
formatted to look nice.  I would like to avoid the borders and fixed 
height (with scroll bars) of the <TEXTAREA> field and instead put the 
text into an auto height table cell with fixed width=500 so the text 
still wraps nicely on the screen.  I've set up a table with 3 columns 
to allow me to display the title, author, date, etc. nicely at the 
top and then defined a table cell that spans the 3 columns to hold 
the article.

echo "<TD colspan=\"3\" width=\"532\"><P>$article</P></TD>";

The text displays, but the paragraph breaks are gone and all the text 
is just run together into one long paragraph.

Any suggestions on how to get $article to display and keep the white 
space between paragraphs that it has when displayed in a 
<FORM><TEXTAREA> like

echo "<td colspan=6><textarea name='article' rows='15' 
cols='120'>$article</textarea></td>";

For an example, see 
http://www.cobblekids.org/Pages/Articles/Article_View4b.php and click 
on an article title.

Thanks,
-Landy

Thread
Text formatting of articles pulled from database??Landy Atkinson19 Mar
  • Re: Text formatting of articles pulled from database??Henning Heil19 Mar
Re: Text formatting of articles pulled from database??Stefan Hinz19 Mar