Page 1 of 2
nl2br in textarea
Posted: Sat Mar 27, 2004 11:54 am
by jarow
When this runs in the body of my page it works perfectly, seperating the lines fine without printing the actual code <br> and </br>:
<?php echo nl2br ($row_cv['proyecto']); ?>
however when I place this within a text area
<textarea name="textarea"><?php echo nl2br ($row_cv['publicaciones']); ?></textarea>
the text in the text box prints out each <br> and </br>
what gives?
Posted: Sat Mar 27, 2004 1:16 pm
by Goowe
Just a guess...
I don't think textboxes will let HTML be run through them... I think if you don't worry about running the nl2br function on it, it will still return in the textbox?
Good luck

Posted: Sat Mar 27, 2004 1:46 pm
by tim
nlbr is a function, assign it a variable.
ie:
Code: Select all
$char = nl2br($text);
<textarea>$char</textarea>
also I think goowe has a point, the html will parse the line breaks itself
Posted: Sat Mar 27, 2004 1:48 pm
by tim
also try
<textarea value=$text></textarea>
not sure what your doing 100%
Posted: Sat Mar 27, 2004 1:54 pm
by darkforcesjedi
I don't think you need the function at all.
<textarea>this
is
a
test</textarea>
puts all that on different lines. so
<textarea><?PHP echo "this\nis\na\ntest" ?></textarea>
should do the same
Posted: Sat Mar 27, 2004 3:40 pm
by d3ad1ysp0rk
^exactly
you'd only need the function if you were outputting to the page, not the textarea (if you know what I mean).
Breaks in text areas are \n, breaks in regular HTML is <br />.
Posted: Sat Mar 27, 2004 4:58 pm
by vigge89
LiLpunkSkateR wrote:^exactly
you'd only need the function if you were outputting to the page, not the textarea (if you know what I mean).
Breaks in text areas are \n, breaks in regular HTML is <br />.
breaks in Windows are \r\n

Posted: Sat Mar 27, 2004 5:09 pm
by Weirdan
vigge89 wrote:breaks in Windows are \r\n

Breaks in win are CR LF

Posted: Sat Mar 27, 2004 6:51 pm
by tim
breaks in life are...
well,
/
what are breaks in life??? i dont get any
Posted: Sat Mar 27, 2004 7:23 pm
by d3ad1ysp0rk
Snap into a slim jim?
Posted: Sat Mar 27, 2004 7:27 pm
by darkforcesjedi
vigge89 wrote:breaks in Windows are \r\n

internet explorer is programmed to recognize both types of line breaks. i dunno about mozilla/netscape/opera for windows though. they probably support both as well.
Posted: Sun Mar 28, 2004 8:55 am
by Steveo31
LiLpunkSkateR wrote:Snap into a slim jim?
EAT ME!!
Posted: Sun Mar 28, 2004 11:02 am
by tim
my mother is the only person I know who could live off beefsticks. she cant leve any type of store that would harbor beefsticks w/o buying 2, one for the walk, 1 for the road.
shes got the bug i guess lol
Posted: Sun Mar 28, 2004 12:50 pm
by vigge89
well, breaks in windows could also result in a crash

Posted: Sun Mar 28, 2004 12:55 pm
by m3mn0n
</br>??
Don't you mean <br />