SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Jan 2007
    Posts
    971
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Retaining html formatting in submitted data

    Hi,

    Is there a good way to retain HTML formatting after its been added and retrieved from a database? I'm using the fckeditor, but could use a text field for this if necessary. After I format the source, and switch back to wysiwg mode and then switch back, the code has lost all the carriage returns/new lines.

    Thanks.

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nl2br()

  3. #3
    John 8:24 JREAM's Avatar
    Join Date
    Sep 2007
    Location
    Florida
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use:

    htmlspecialchars($yourthingy);

    then to put in wysiwyg I use

    htmlspecialchars_decode($yourthingy);

  4. #4
    SitePoint Guru
    Join Date
    Jan 2007
    Posts
    971
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    thanks for the ideas.
    Don't think nl2br() will work because I only want the source to retain its formatting when you are reading the source. So essentially, I'd like to retain the /n's without them getting messed up by mysql_escape_string/stripslashes.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •