SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jul 2000
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've written a guestbook script with a textarea for visitors to drop comments, but when someone makes a new line by pressing <Enter>, the data file that the guestbook saves to messes up since I make every entry on its own line. How to translate the <Enter> new lines to <br> and keep it on the same line in the saved file? Or can I simply write a script to filter out all the new lines?

    - Jeremy

  2. #2
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use the PHP function nl2br() to convert your textarea text to something legible:
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>

    $myTextToDisplay = nl2br ( $myTextAreaData );

    [/code]

    ------------------
    Karl Austin
    KDA Web Services
    "Everyone has a photographic memory. Some just don't have film."


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
  •