Re: Hidden Input and Quotes?
| From: | Jason Caldwell | Date: | Sat, 12 May 2001 01:56:31 +0000 |
| Subject: | Re: Hidden Input and Quotes? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-52533@lists.php.net to get a copy of this message | ||
> The " will be translated back into "
> when your form is submitted.
?? I don't have to convert back?? -- when I eventually submit my Hidden
Input Fields into my mySQL DB, they'll be converted back to " ?
Confused....
"Young Chi-Yeung Fan" <yf32@cornell.edu> wrote in message
news:3AFC9469.7D9F540A@cornell.edu...
> Jason Caldwell wrote:
>
> > If I have a text box and enter data into that text box with "quotes"
around
> > some of the text... and I want to throw that text into a HTML Hidden
Input
> > Field (on my next screen for example) -- the quotes will somehow jackup
or
> > truncate that text... because HTML uses "quotes" within in the Hidden
Input
> > Field.
> >
> > So my question is, should I (or, really, can I) encode it? My thinking
is I
> > want to encode it with the htmlspecialchars() function... however,
> > eventually, all the data within the Hidden Input Boxes will be stored
into
> > my mySQL database, so I'll want to decode it before I send it (restoring
the
> > quotes)... is there a way to decode the htmlspecialchars() function?
Or, is
> > there a better way to do this (*without* creating a session)? -- I want
to
> > use Hidden Input Fields.
>
> An easier thing to do would be *not* to use htmlspecialchars(), but
instead
> replace all instances of " with " . That's assuming your hidden input
field
> uses " instead of ' to quote the attribute values. You can just do:
>
> ereg_replace("\"", """, $data);
>
> Then you don't have to decode anything to restore the quotes and other
> characters that have been changed. The " will be translated back into
"
> when your form is submitted.
>
> Young
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>