SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: help newbie

  1. #1
    SitePoint Member
    Join Date
    Feb 2009
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help newbie

    iam trying to post some text and some smilies on a comments form, when i preview the form, i get the text and smilies all showing on the same line.

    example

    hello world
    goodbye

    but its showing like this
    hello worldgoodbye

    could someone point me in the write direction on how to do this
    thankyou

  2. #2
    SitePoint Member
    Join Date
    Sep 2007
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is it just when you've added the smilies? Check it in the db, and the field should have new lines ("\n", but invisible)

    Either way, look into php.net/nl2br

  3. #3
    SitePoint Member
    Join Date
    Jul 2008
    Location
    Austin, TX, USA
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is possible that you are processing "\n" as they are. You might want to convert them to br's before showing on the page.

  4. #4
    SitePoint Member
    Join Date
    Feb 2009
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HI
    thank's for your comments iwent to php.net/nl2br you was right it was nl2br
    had to put this in the form <?=smiley( nl2br($comments) ) ?>
    works great thanks

  5. #5
    SitePoint Wizard
    Join Date
    Mar 2008
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    By the way, if this isn't a test site, make sure that you sanitize the HTML so that people don't post cookie-stealing code and such.


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
  •