Hello again (unfortunately). When i try to display text taken from database and place in between borders of the table the content is not wrapping. Why?
Here is the code:
Adding text to database:
<textarea rows="10" cols="114" name="area" wrap="physical">Put the content here</textarea>
Retrieving and displaying it:
echo "<table border ='0' width='900' bgcolor='#000000' align='center'";
echo "<pre id='description_table'>";
And style of above content:
When each line has more characters than fit in the table - table is stretched beyond 900 px. How to force text to wrap? Thanks for all answers
Someone gave me an address http://www.impressivewebs.com/css-white-space/. I need to try it. Meanwhile maybe does anybody know how to display WHOLE TEXT !AS IS! even with characters like “<” and “>” without affecting the display page (i mean if user will put in text <font color=‘red’>text</font> it should display the same code and not text in red color?
I forgot that if i want to display all “<tag>” i need first to put it into database correctly ehh ;/
EDIT (15mins later)
I just removed “<PRE>” and text is displayed ALMOST correctly. ALMOST because the table is no longer stretched beyond screen border but if user puts many spaces one after another displayed is only one. The rest of them are skipped. Any clues?
there is a php function to convert line breaks to <br>. its something like nl2br.
You can change spaces to but not sure if it would play well with word wrap.
Alternatly you could look for 2 spaces in a row and replace one of them with
What happens if you give <td> a width?
echo " <td width='900'>";
it makes no difference.
On my local forum (polish) someone told me i cannot use “<PRE>” because it prevents from automatic wrapping.
Ok. I can remove “<PRE>” but how to display text with all it’s spaces and new lines?