Web Analytics Made Easy -
StatCounter embedding html - CodingForum

Announcement

Collapse
No announcement yet.

embedding html

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • embedding html

    Hi guys,

    i think i chose the right title

    what i want to do or know how to do , is when i copy text from a page
    and paste it into a text box which then gets stored in a table,

    how can i keep the html formatting ?

    eg if there was a paragraph space or a line break how can i get that into the db ?

    eg look here http://www.pet-advice.net/article.php?aid=43

    that clearly should be formatted

    without opening each page with notpad and copying the source i dont know any other way to get teh formatting

    any help would greatly be appreciated

    chris

  • #2
    Line breaks are stored in MySQL as a "\n" character. But as you know, an HTML document doesn't display "\n" as a line break-- you need to use <br /> or even <p></p> tags. One easy way to transform "\n" to <br /> is wth the nl2br() function.

    Comment

    Working...
    X