Re: HTML_QuickForm addOptions Value and htmlspecialchars

From: Date: Fri, 01 Sep 2006 02:49:37 +0000
Subject: Re: HTML_QuickForm addOptions Value and htmlspecialchars
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-25040@lists.php.net to get a copy of this message
On 8/31/06, Alexey Borzov <borz_off@cs.msu.su> wrote:
Hi, led_belly wrote: When processed, the markup for the option is as follows: <option value="ga_merchants.php?op=deals&amp;id=1963">Test Item</option> I am using javascript to load new content when an option is selected so the value of the option must be a valid URI (i.e.: I need '&' NOT '&amp;'). Any suggestions? There is a javascript function in recent HTML_QuickForm_hierselect for unescaping the HTML entities.
I'd just like to point out that & is not valid by itself in XHTML (and not HTML, IIRC). It *has* to be escaped as &amp; in order to be valid. Note that this is also done to avoid XSS (Cross Site Scripting) attacks. Your browser *should* be replacing the &amp; with & in the real value, but this may be one of the places (in JS) where the value stays as the original even though it technically shouldn't. When the value is *submitted* again, however, it will almost surely be & and not &amp; -- Justin Patrin

« previous php.pear.general (#25040) next »