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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to