I have a simple PHP database that I use to record and later re-display
articles for a small publication. Sometimes the headlines contain single
*and* double quotes... This is not a problem for me to display them in an
html output, but I have the option to re-edit the articles, meaning the
original form with original values is written back in... The problem is
though, I'm unsure as to how I can permit single and double quotes from
appearing inside a form text box, using something like the following, as an
example...
<input type=text name=headline size=30 maxlength=30 value=""They're not
there" he says">
I have considered using a backslash, but the backslash appears in the value
so if my idea is right, perhaps I''m implementing it wrong...
anybody got any ideas?
thanks
randelld
" => "
" => "
' => '
"Randell D." <you.can....@randelld.at.yahoo.com> wrote in message
news:9ef2a.239032$H7.83...@news2.calgary.shaw.ca...
<input type="text"
name="headline"
value=""They're not there" he says">
Take a look at http://www.php.net/manual/en/function.html-entity-decode.php
"FlibberJibbet" <nu...@notarealaddress.com> wrote in message
news:Ejf2a.762$WR4....@newsfep4-glfd.server.ntli.net...
You can use entities (e.g. " for ") or character references (e.g.
" for " and ' for ') to escape quotes in attribute values.
> You can use entities (e.g. " for ") or character references (e.g.
> " for " and ' for ') to escape quotes in attribute values.
Yes, but the apostrophe need not be "escaped" when the attribute is enclosed
into quotation marks.
On the other hand, the question arises what _else_ gets written into the
attributes. If the data comes from database entries containing headlines,
there's really nothing to stop _any_ characters*) from getting into the
attribute values, unless some filtering is specifically programmed. I'm
pretty sure there's some general-purpose _function_ in PHP to handle such
issues.
*) such as the string ©, which will be treated as copyright symbol by
browsers, or non-Ascii with potentially confusing effects.
--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
Many thanks... I had been incorrectly playing around with urlencode and
urldecode but now see why I was wrong...
thanks for pointing me in the right direction...