PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
jarow
Forum Commoner
Posts: 83 Joined: Tue Jan 28, 2003 2:58 am
Post
by jarow » Sat Mar 27, 2004 11:54 am
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?
Goowe
Forum Commoner
Posts: 94 Joined: Mon Mar 15, 2004 9:51 am
Location: Southeast Alaska
Post
by Goowe » Sat Mar 27, 2004 1:16 pm
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
tim
DevNet Resident
Posts: 1165 Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio
Post
by tim » Sat Mar 27, 2004 1:46 pm
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
tim
DevNet Resident
Posts: 1165 Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio
Post
by tim » Sat Mar 27, 2004 1:48 pm
also try
<textarea value=$text></textarea>
not sure what your doing 100%
darkforcesjedi
Forum Newbie
Posts: 5 Joined: Sat Mar 27, 2004 1:33 pm
Post
by darkforcesjedi » Sat Mar 27, 2004 1:54 pm
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
d3ad1ysp0rk
Forum Donator
Posts: 1661 Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA
Post
by d3ad1ysp0rk » Sat Mar 27, 2004 3:40 pm
^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 />.
vigge89
Forum Regular
Posts: 875 Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden
Post
by vigge89 » Sat Mar 27, 2004 4:58 pm
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
Weirdan
Moderator
Posts: 5978 Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine
Post
by Weirdan » Sat Mar 27, 2004 5:09 pm
vigge89 wrote: breaks in Windows are \r\n
Breaks in win are CR LF
tim
DevNet Resident
Posts: 1165 Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio
Post
by tim » Sat Mar 27, 2004 6:51 pm
breaks in life are...
well,
/
what are breaks in life??? i dont get any
d3ad1ysp0rk
Forum Donator
Posts: 1661 Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA
Post
by d3ad1ysp0rk » Sat Mar 27, 2004 7:23 pm
Snap into a slim jim?
darkforcesjedi
Forum Newbie
Posts: 5 Joined: Sat Mar 27, 2004 1:33 pm
Post
by darkforcesjedi » Sat Mar 27, 2004 7:27 pm
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.
Steveo31
Forum Contributor
Posts: 416 Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA
Post
by Steveo31 » Sun Mar 28, 2004 8:55 am
LiLpunkSkateR wrote: Snap into a slim jim?
EAT ME!!
tim
DevNet Resident
Posts: 1165 Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio
Post
by tim » Sun Mar 28, 2004 11:02 am
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
vigge89
Forum Regular
Posts: 875 Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden
Post
by vigge89 » Sun Mar 28, 2004 12:50 pm
well, breaks in windows could also result in a crash
m3mn0n
PHP Evangelist
Posts: 3548 Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada
Post
by m3mn0n » Sun Mar 28, 2004 12:55 pm
</br>??
Don't you mean <br />