Re: An "escape special characters" problem
| From: | Jason Wong | Date: | Sat, 15 Feb 2003 20:21:33 +0000 |
| Subject: | Re: An "escape special characters" problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-135704@lists.php.net to get a copy of this message | ||
On Sunday 16 February 2003 02:58, Robert E. Harvey, M.D. wrote:
> echo "<option value='$algen'>$algen\n";
> The problem arises when one of the strings from the table algen has an
> apostrophe in it such as "Queen Anne's Lace" or "Lamb's
> Quarters". It
> displays properly in the form. What is passed to $HTTP_POST_VARS is:
> "Queen Anne" or "Lamb".
What you _see_ displayed is the 2nd $algen in the above line. The actual value
that is passed when the form is submitted is in the 1st $algen. But because
the value is delimited by single-quotes and your value itself contains
single-quotes you have a problem -- look at your HTML source.
> How can arrange my code to pass the entire strings to $HTTP_POST_VARS
> and not just the truncated versions?
apply htmlspecialchars() to the 1st $algen.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Occam's eraser:
The philosophical principle that even the simplest
solution is bound to have something wrong with it.
*/