Re: htmlspecialchars() and HTML code

From: Date: Fri, 08 Aug 2003 16:21:13 +0000
Subject: Re: htmlspecialchars() and HTML code
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-158884@lists.php.net to get a copy of this message
Thanks everybody! Looks like I was just thinking about the problem too hard. Thaddeus John W. Holmes wrote:
Thaddeus J. Quintin wrote:
CPT John W. Holmes wrote: --<SNIP>--
Try this: <textarea name="text">This is &lt;some&gt; text</textarea> If you submit that "text" and then print $_REQUEST['text'], you'll
see that
you have This is <some> text
--<SNIP>-- Ok, but that only makes me realize the further extent of the problem. If the HTML file that they upload has '&lt;' or '&gt;' entities, then these characters will be displayed in the text area as '<' and '>' symbols. So when the text is submitted from the textarea, all of the user's HTML entities will have been destroyed. Any thoughts on this problem?
Yep, of course. :) If there is a &lt; in the file, when you apply htmlentities(), it'll come out in the HTML source as &amp;lt; and appear as &lt; in the rendered <textarea>. So... it's not an issue.


« previous php.general (#158884) next »