SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: simple question

  1. #1
    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)

    simple question

    hey,

    I must be having a particularly blonde moment, because I can't for the life of me remember the code i need to do this.

    I use this as part of my web based form (sendmail):

    PHP Code:
    $body "\n Name: " quotemeta ($name) .
    "\n Comments: " quotemeta ($comments); 
    (obviously there are lots of other bits to it, but the main constituents of the body are contained in these lines...)

    but when I receive the email, it has put slashes in all the special chars. What I want to know is... how do I stop it from putting in the slashes? I have tried a few things but I think my brain shut down a good year or so ago...
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  2. #2
    SitePoint Wizard
    Join Date
    Jul 2001
    Location
    The Netherlands
    Posts
    2,617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not to knowledgable on this subject, but I still would like to give it a try. Have you tried the strippslashes() function already?

  3. #3
    SitePoint Guru
    Join Date
    Aug 2001
    Location
    Amsterdam
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would do it a bit different I think..

    something like this:

    Code:
    $body = "
    \n 
    Name: $name\n
    Comments: $comments\n
    ";
    If you have to do stuff with the $name and $comment I would do it before the $body stuff this way you keep it nice and tidy..


    Good luck,

    Peanuts
    the neigbours (free) WIFI makes it just a little more fun

  4. #4
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Mark T.
    Have you tried the strippslashes() function already?
    Yep sounds like you need to use stripslashes()

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  5. #5
    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)
    well I did and it didn't work.

    can you post the correct syntax of the code for me?

    thanks!
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  6. #6
    Happy Holidays !! Paul S's Avatar
    Join Date
    Mar 2001
    Location
    Mexico
    Posts
    1,287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I agree with Mark and Sean
    are you sure you have tried this and still no results?
    PHP Code:
    $body "\nName: ".stripslashes($name)."\n
    Comments: "
    .stripslashes($comments)."\n"
    If both variables come from a form (GET or POST method) and you have magic_quotes enabled then by default PHP will return all the special characters escaped. If you use quotemeta() then you are telling PHP to escape again all thise characters : . \\ + * ? [ ^ ] ( $ )

  7. #7
    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)
    Originally posted by Paul S
    I agree with Mark and Sean
    are you sure you have tried this and still no results?
    PHP Code:
    $body "\nName: ".stripslashes($name)."\n
    Comments: "
    .stripslashes($comments)."\n"
    If both variables come from a form (GET or POST method) and you have magic_quotes enabled then by default PHP will return all the special characters escaped. If you use quotemeta() then you are telling PHP to escape again all thise characters : . \\ + * ? [ ^ ] ( $ )
    thanks paul (and sean and mark!) -- I'll give it another crack.
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  8. #8
    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)
    Well i don't know what I was doing when I tried stripslashes before, but that worked perfectly.

    Thanks guys!
    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
  •