K
K
Kirill2014-12-03 23:15:45
CodeIgniter
Kirill, 2014-12-03 23:15:45

Why are html entities not converted via html_entity_decode?

Guys, hello!
Please help! Very much! Killed all day, I can not understand what kind of garbage this is.
The crux of the problem!
I store the autoresponder hidden fields in the database so that I can use them later. When the form is submitted, these hidden autoresponder fields are run through htmlentities to sanitize the code, then written to the database. - Everything is good here! The recording passes, the transformation too.
BUT! When decoding HTML entities are not converted, I use the function - html_entity_decode.
I have the ability to preview the file in which this data will be written - the problem is that these hidden fields are displayed as plain text - this is what I get in the source code

"<input type='hidden' name='removed_header' value=''><input type='hidden' name='element_privacy' value=''><input type='hidden' name='uid' value='536934'><input type='hidden' name='tid' value='0'><input type='hidden' name='lang' value='ru'><input type='hidden' name='did[]' value='754326'><input type='hidden' name='script_url_1_13' value='https://imgs.smartresponder.ru/on/dc47aab649ed2857667697cf94fb8cd110e6f38f/1_13'>"

And when writing this data to a file, of course, before writing, I run this whole economy through html_entity_decode - I get such a miracle in the file
&lt;input type='hidden' name='removed_header' value=''&gt;&lt;input type='hidden' name='element_privacy' value=''>&lt;input type='hidden' name='uid' value='536934'&gt;&lt;input type='hidden' name='tid' value='0'>&lt;input type='hidden' name='lang' value='ru'&gt;&lt;input type='hidden' name='did[]' value='754326'>&lt;input type='hidden' name='script_url_1_13' value='https://imgs.smartresponder.ru/on/dc47aab649ed2857667697cf94fb8cd110e6f38f/1_13'&gt;

Guys, how to deal with this??? I can't figure out what's wrong at all. :( Please help very much!!!
Or tell me how best to save the HTML code in the database so that you can use it later.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_ _, 2014-12-03
@Lobanov

And why do you need to encode them when writing to the database, why neutralize the code for writing to the database?
You need to neutralize it when inserting it into the page code, and you can insert at least a bald trait into the database - in my opinion today there are no more DBALs that will not escape the data. And your question, as far as I understand, refers specifically to escape.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question