Re: How to escape apostrophe in HTML textbox exactly???
| From: | Chris Shiflett | Date: | Tue, 06 Jul 2004 04:09:32 +0000 |
| Subject: | Re: How to escape apostrophe in HTML textbox exactly??? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-189758@lists.php.net to get a copy of this message | ||
(Disclaimer: This is a few days old, but I am just now catching up.)
--- Scott Fletcher <scott@abcoa.com> wrote:
> In one of the reply to the original posting I made, someone say that
> htmlentities() would work and upon submission, the PHP's $_REQUEST,
> $_POST, $_GET would get the apostrophe somehow. (The conversion
> somewhere would change it back).
This is true, but it's not as mysterious as you make it sound. The browser
will still send the data exactly as you expect - not the HTML entities.
That step only helps you to preserve the data and not have it accidentally
interpreted as part of the markup, which is what your original problem
was.
Of course, if you want to display this data again, you will have to use
htmlentities() again on the data in $_GET, $_POST, or whatever.
Hope that helps.
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly
Coming Fall 2004
HTTP Developer's Handbook - Sams
http://httphandbook.org/
PHP Community Site
http://phpcommunity.org/