note 43936 added to function.htmlentities
| From: | php at steve-parker dot org | Date: | Fri, 09 Jul 2004 02:08:15 +0000 |
| Subject: | note 43936 added to function.htmlentities | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-72908@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/function.htmlentities.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43936
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43936&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43936&report=yes
Search -- http://master.php.net/manage/user-notes.php