|
Posted by Paul Lautman on 08/22/07 17:59
J.O. Aho wrote:
> mbarbs wrote:
>> On Aug 22, 9:21 am, "J.O. Aho" <u...@example.net> wrote:
>
>>>> The problem is i have this for example <a
>>>> href="link.html">Link</a> in one of the fields in the mysql
>>>> database. When the page loads it shows the html <a
>>>> href="link.html">Link</a> NOT a clickable link.
>>> The problem is how you store the value to the database, you most
>>> likely used htmlentities() or a simialr function on the string
>>> before you stored it, which makes it to be displayed as it's
>>> written and not parsed by the browser as html-code.
>
>> How would you recommend the best way to do this?
>>
>
> If you use a form to input the data, you may need to use
> html_entity_decode() to get rid of all htm encoded characters (you
> don't want those)
>
> Before you store data into the database, you want to run
> addslashes(), this prevents problems with " or ' in the strings.
>
> And when you fetched the data from the database, use stripslashes(),
> before you echo things out.
Forget the stripslashes!
Navigation:
[Reply to this message]
|