SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Oct 2001
    Posts
    439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    FOrmatting text from textarea

    Hey folks,
    I have a form, with a textarea field....This is used to accept text, which will then be included on a webpage.....When the form field is passed,I do this:

    $text = nl2br($_POST['body']);

    Here is the problem.....It is inserting \ before any occurent of " or '

    Does any know how I can remedy this........

    thanks guys

  2. #2
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    PHP Code:
    $text stripslashes(nl2br($_POST['body'])); 

  3. #3
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The EVIL magic quotes is on. If you've experience of .htaccess you can switch it off, since I am assuming you are on a virtual host and getting them to change it would be a nightmare.

    PHP Code:
    <IfModule mod_php4.c>
        
    php_flag magic_quotes_gpc off
    </IfModule
    read this for more info.
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky


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
  •