Jump to content


Photo

A stupid Newbie question


  • Please log in to reply
2 replies to this topic

#1 mum4d

mum4d
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 17 March 2006 - 10:13 AM

I have a form that puts text into a MySql database. The text can contain carrage returns to create paragraphs.

When I echo the text into a text area, all looks OK.

BUT

When I echo the text direct, the line breaks do not work and everything appears in one line.

How do I echo the text so it appears correctly, including line breaks, without placing in in a text area tag???

Example:-
this works
<textarea name="textfield" cols="70" rows="12"><?php echo $row_Recordset1['Description']; ?></textarea>

this don't work
<?php echo $row_Recordset1['Description']; ?>

Thanks in advance

#2 webwiese

webwiese
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 17 March 2006 - 10:44 AM

Hi,

nl2br($yourtext) transaltes linebreaks into <br>.



#3 mum4d

mum4d
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 17 March 2006 - 10:50 AM

[!--quoteo(post=355888:date=Mar 17 2006, 10:44 AM:name=webwiese)--][div class=\'quotetop\']QUOTE(webwiese @ Mar 17 2006, 10:44 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Hi,

nl2br($yourtext) transaltes linebreaks into <br>.
[/quote]

Thanks Webwiese, works exactly how I want.

Thanks again!





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users