note 43936 rejected from function.htmlentities by aidan
| From: | aidan@php.net | Date: | Fri, 09 Jul 2004 04:52:00 +0000 |
| Subject: | note 43936 rejected from function.htmlentities by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72911@lists.php.net to get a copy of this message | ||
Note Submitter: php@steve-parker.org
----
This must be a stupid question... it used to work until I changed hosting providers (all PHP 4.3).
I have a "Mail me" form, with a TEXTAREA for the message. <form
action="sendmail.php" method=post>
I want to give feedback ("You posted blah") in HTML and, of course, send an email to
myself, without HTML formatting.
Page formatting snipped for clarity:
$COMMENTS=$_POST['Comments'];
$HTML_COMMENTS=htmlentities($COMMENTS, ENT_QUOTES);
$REAL_COMMENTS=html_entity_decode($HTML_COMMENTS);
if (mail("me@my.domain", $Subject, $REAL_COMMENTS, $headers)) {
echo "Thanks, got your email. Keep surfing with the links to the left,";
echo "or go back to <a href=\"${referer}\">$referer</a>";
} else {
echo "There may have been a problem delivering the email. Oops!";
}
echo "Your Comments:<P>${HTML_COMMENTS}";
Given the input of:
foo="bar"; echo $1
I'd expect the HTML page produced, to be:
foo="bar;"& echo $1
And the email produced, to be:
foo="bar"; echo $1
What I do get (with any combination of ENT_*), is (in both the HTML page and the email):
foo=\\"bar\\"; echo $1
I must be missing something obvious; any assistance appreciated.