SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Apr 2001
    Location
    BC, Canada
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey.. heres the problem

    I have a field that is a text area.
    People put information in it and is saved to a database in a collum called details. its set as a varchar(255).
    How can I make it so that if the user enters information with breaks in it .. like so..

    if they typed
    it
    like..
    soo
    on multiple
    lines

    how can it be saved like that so when it is printed out later its not on one line

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should do the following before inserting into the database:
    PHP Code:
    $var addslashes($var); 
    Although if you have magic quotes turned on in the php.ini file it will do it for you. Then when you pull the data out to view it just run
    PHP Code:
    $var nl2br($var);
    print 
    $var
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


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
  •