Link to home
Start Free TrialLog in
Avatar of Budi Santoso
Budi SantosoFlag for Indonesia

asked on

Locking table

I had successfull when inserting/viewing longtext data format from/in to mySQL database.
But i had a problem when viewing it in html table.
-No paragraph, write in 1 line only without braked line.
-The table width pushed by the text, then the table to be wider. (My page design damaged by that)

My question is :
1. How to locking the table width, so the text will automatically break lined ?
Inserting "<br>" text when inputting data in form textarea annoying me.
So, give me other solution.

2. How to prevent someone to not inserting html code to textarea form ?
Then, all text will be converted to text format.

I use this html form to send one paragraph of text :
<textarea name=news rows=60 cols=100%></textarea>

I use this php code to viewing $news :
print("<table width=50% border=0 cellpadding=0 cellspacing=0><tr><td>");
print("$news \n");
print("</td></tr></table>");
Avatar of penguin3
penguin3

Not sure what you mean by locking the table but under normal usage of text field I guess this line will solve both your problems if put before your print lines.
$news  = nl2br(htmlentities($news ));
Avatar of Budi Santoso

ASKER

Only question number 2 answered by that method.

This is what i means about my question (to locking table width) :

My client inserting 1 paragraph of text (many sentences) to text area form WITHOUT pressing enter button.

Then, NO new line created.

You know that my table width is 50%, long sentences (without new line) will stretching the table.

I had try this, but does'nt work.

print("<P>$news</P>");

  or

print("<PRE>$news</PRE>");

ASKER CERTIFIED SOLUTION
Avatar of penguin3
penguin3

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It's work.
Thank You Very Much 100000x...