SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Dec 2002
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ? about sending a message using mail() and a form

    I am working with small email script using mail(). I have a html form that has a textarea where the body of the email is to be typed. Here is my problem. If for instance I type the message:


    Hello. This is a test. What's up?


    When I echo the string the screen or if I get the message in the email, it looks like this:

    Hello. This is a test. What\'s up?

    Everytime I use a " or ' it is replaced with a \' or \". How can I fix this?

  2. #2
    SitePoint Guru GamerZ's Avatar
    Join Date
    Nov 2001
    Location
    Singapore
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    before you put the text into the mail() function, use stripslashes() onit.

    IOW, if $text is your posted message, do this
    PHP Code:
    $text "Hello. This is a test. What\'s up?";
    $text stripslashes($text);
    // Use mail() now. 
    HTH.
    aaron

    /edit
    Damn, GamerZ, beat me to it
    Last edited by Sketch; Dec 3, 2002 at 09:33.
    Aaron Brazell
    Technosailor



  4. #4
    SitePoint Member
    Join Date
    Dec 2002
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah.... so simple! I'll try it. Thanks guys!

  5. #5
    SitePoint Guru GamerZ's Avatar
    Join Date
    Nov 2001
    Location
    Singapore
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Sketch
    before you put the text into the mail() function, use stripslashes() onit.

    IOW, if $text is your posted message, do this
    PHP Code:
    $text "Hello. This is a test. What\'s up?";
    $text stripslashes($text);
    // Use mail() now. 
    HTH.
    aaron

    /edit
    Damn, GamerZ, beat me to it
    LOL, was 1 min earlier


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
  •