Jump to content


PHP: Read Text File, Keep Formatting


2 replies to this topic

#1 JoeVincetti

    Young Padawan

  • Members
  • Pip
  • 82 posts

Posted 02 October 2005 - 09:55 AM

About: I read from a text file using PHP and try to display the files contents in an html page. (html page includes the text file.)

Problem: When I read the text file, all formatting is removed when its displayed. The formatting still exists when I view the page source. By formatting I mean spacing. (including line breaks.) Is there a function i could use to display spacing?

#2 softLearner

    Young Padawan

  • Members
  • Pip
  • 128 posts

Posted 02 October 2005 - 10:31 AM

Use the ntl2br() function. Check it out @ php.net

#3 JoeVincetti

    Young Padawan

  • Members
  • Pip
  • 82 posts

Posted 02 October 2005 - 11:28 AM

Thanks a lot. I searched PHP.net, and it said the function was nl2br(). It fixed my poblem. Thanks again.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users