Jump to content


Photo

Easy question?


  • Please log in to reply
2 replies to this topic

#1 hostfreak

hostfreak
  • Members
  • PipPipPip
  • Advanced Member
  • 581 posts

Posted 06 September 2006 - 08:08 AM

I am sure there is an easy answer to this, but it's something I have never needed to do/think about. I've made a simple news script to post small updates etc. I store the posted news in a text field in a database. So my problem is that when I am typing the news, say I hit enter a couple times to go down a couple lines or what not. When I echo the news from the field (news) everything is put together. The lines I entered are no longer there. Is there any way to enter the lines into the database?

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 06 September 2006 - 08:18 AM

Not sensibly.  The solution is to use the nl2br() function when outputting the information:

echo nl2br($news_item);

Legend has it that reading the manual never killed anyone.
My site

#3 hostfreak

hostfreak
  • Members
  • PipPipPip
  • Advanced Member
  • 581 posts

Posted 06 September 2006 - 08:25 AM

Thanks Andy, that worked.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users