SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    PHP Escaping Quotes From Form

    I'm trying to use PHP to send an HTML-formatted email message (since Outlook Express sends as multipart/alternative and with PHP I can set the header as html/text).

    The problem is when I submit the message to the PHP script via a form (the only input is a textarea where I paste in the HTML), all the quotes, single quotes, etc. get escaped in the actual mailing, messing up all the HTML. How do I get it to send the message exactly as I pasted it into the text area?

    Here's the script:

    PHP Code:
    <HTML>
    <BODY>

    <?php
    $to 
    "bizpronews-post-geocity@topica.com";
    $subject "test html php 3";
    $headers "From: [email]webmaster@websitegoodies.com[/email]\nMIME-Version: 1.0\nContent-Type: text/html; charset=us-ascii";
    mail("$to""$subject""$msg""$headers");
    echo 
    "finished!";
    ?>

    </BODY>
    </HTML>
    Here's the form:

    <form action="testsend.php" method="post"><textarea name="msg" cols="30" rows="5"></textarea><br><input type="submit"></form>
    Please help. Thank you in advance!

  2. #2
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use stripslashes() on the $msg.
    ck :: bringing chris to the masses.

  3. #3
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thanks! stripslashes() worked perfectly and the message came through perfect.

    Looks like I'll be offering an HTML version of my ezine soon


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
  •