Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Textarea problem

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Textarea problem

Postby gz1981 » Wed Feb 12, 2003 5:28 pm

i want multiple lines input.
so i get the useinput from a textarea. and store the value in
a database.
however, when i retrive the data and display it, all the things becomes one line.
how can i solve this problem?>??? :?: :?: :?:
User avatar
gz1981
New php-forum User
New php-forum User
 
Posts: 3
Joined: Tue Feb 11, 2003 4:45 am

Postby Redcircle » Wed Feb 12, 2003 5:31 pm

use the function nl2br() in the output.

example

echo nl2br($row['body');

What this function does is change all new line chars (\n) to an html <br>
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby gz1981 » Wed Feb 12, 2003 5:46 pm

Thanx man,
that function does a good job. but i still got one question =====>
if i got a line of text long enough to display in the table, how can i make the cell expand vertically? i.e make the cell width fixed
User avatar
gz1981
New php-forum User
New php-forum User
 
Posts: 3
Joined: Tue Feb 11, 2003 4:45 am

Postby Redcircle » Wed Feb 12, 2003 5:53 pm

put the output within a table with a fixed width

<table width="100"><tr><td>blah blah blah....</td></tr></table>
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby gz1981 » Wed Feb 12, 2003 6:02 pm

I just write the following code. but i still get a longlong line. insead of multi line with 100 pixels' width
Code: Select all
<html>
<head></head>
<body>
<TABLE WIDTH="100">
<TR>
 <TD>
   AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 </TD>
</TR>
</TABLE>
</body>
</html>
User avatar
gz1981
New php-forum User
New php-forum User
 
Posts: 3
Joined: Tue Feb 11, 2003 4:45 am

Postby Redcircle » Wed Feb 12, 2003 6:11 pm

if it were a normal sentence with spaces between the characters it would contrain it within the 100
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 5 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.