textarea pb.....

A

Anonymous

Guest
i have my text area...

i wonder how i can recongnise that the user press enter (char(13) or s/thing like dat)...

cuz after i store this info in a DB (mysql) and when i put it back on a HTML page i wanna go to the line...like in the text area..

i ve tried $var = str_replace('\r\n','<br>',$fieldname);

but it doesn't work..

in fact how is the cariage return coded?

thx all

cho@
 
Do this:

$fieldname = nl2br($fieldname);

and all your worries are over :) It does just what it says (converts newlines 2 <br>'s

PHP Reference: http://www.php.net/nl2br

Have Fun !!

Will
 
To display new lines in a text area you have to use the html entity for a new line which is
. <br> won't work, that's for normal text, not text areas!
 
to:elitecodex

thx for the thingy it works very well... :wink:
 
to:Jay


sorry i might have not very well express my needs...
in fact i dont wanna display the results in an other texarea...
(not now)..
if i want it l8er then..thx for the thingy...i ll remember.. :wink:
 
Back
Top