SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Text Format

  1. #1
    SitePoint Member
    Join Date
    Aug 2001
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Text Format

    this will probably be a stupid question, but i have a script i built that lets people submit little stories into my database. The current problem i have is that when they fill out the textarea field and hit submit, all of the formatting (the paragraphs, blanklines, etc), gets lumped into one huge textfield in my database.

    is this a MySQL issue? a PHP or HTML FORM issue? i do i preserve all of this formatting?
    signature

  2. #2
    SitePoint Member
    Join Date
    Aug 2001
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, i feel like an idiot now. i just saw that there was another post on the exact same subject (the term "whitespace" threw me off when i first skimmed the threads).

    so you may now all ignore this post and for those looking for the same thing, go here:

    http://www.php.net/manual/en/function.nl2br.php
    signature

  3. #3
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    all of the formatting (the paragraphs, blanklines, etc), gets lumped into one huge textfield in my database.
    AS a side note, this is a good thing. It keeps the data separate from the html. Use function like nl2br when pulling data out of the database not before inserting it in. The line breask will still be in the database, but it will keep your data sanitzied and ready to use in other apps if needed without the <br> tags being stored along with it.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  4. #4
    SitePoint Member
    Join Date
    Aug 2001
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oohhhh, good point. i shall adjust my script to do that
    signature


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
  •