Posted by Jochem Maas on 01/13/06 19:17
Jay Blanchard wrote:
> I am having a problem with a an ampersand sign. I have a list of things on a
> page, in which one category is 'Oil & Gas'. I store it in the database as
> 'Oil & Gas'. When the category is clicked the query string shows just an
> ampersand, i.e.
'problem' 1 is the form in which you store the string in the DB. '&
is html encoding - your DB is not a webpage ergo it doesn't need to contain html entities!
that is to say - only make html entities of characters when you need to (i.e.
after you have extracted the data from the db but before you send it to the browser)
'problem' 2 is that you need to urlencode the string 'Oil & Gas' when you want it
to be the value of a url parameter; I have a sneaking suspcision that urlencoding
the string 'Oil & Gas' will not do what you want exactly.
you might consider using a different url parameter seperator character than
the ampersand for this particular app. - the semicolon is often mentioned as
a good alternative (it's even mentioned in the std php.ini)
> "Filter=Process&FilterKey=Oil%20&%20Gas&Order=Application&Direction=ASC&comm
> ents=" and therefore just shows as an '&' and the query only sees 'Oil'.
>
> I guess that I am too tired to deal with this or the answer would come to
> mind immediately. Can someone drop kick me in the right direction? Thanks!
hope the kick didn't break anything. :-)
have a nice weekend regardless!
>
[Back to original message]
|