My MySQL database has some fields that sometimes include an apostrophe, so I take care to encode html entities. For example "Cote d'Or" is stored in the database as "Cote d&039;Or".Html лица в <a href=
When a MySQL query populates an href I get something like this in my source code.
<a href="/page.php?location=Cote d&039;Or">Text link</a>
However when I click on the link I get a 403 "Forbidden" error. On checking, hovering on the link says it is reading &039; as an apostrophe. That seems to be the cause of the page error as putting an apostrophe in the database produces the same error and having nothing in there works correctly.
My question now is, how can I have the html entity in the database and still get the link to work correctly?
Хотя 'urlencode()' является правильным способом представления специальных символов в URL-адресах, при посылке их в HTML по-прежнему требуется вызов 'htmlspecialchars()' или 'htmlentities()'. Правильный способ сделать это: '$ link = '/page.php?location='. htmlspecialchars (UrlEncode ($ место)); ' – axiac