PDA

View Full Version : html tags changed to < and > when saved to database...


Daniellez
08-08-2009, 04:13 AM
I have a language file that has the following arrays:

$lang['signup_gender_values'] = array(
'M' => '<img class="absmiddle" src="/gfx/icon=male.png" width="16" height="16" alt="Male" border="0" />',
'F' => '<img class="absmiddle" src="/gfx/icon=female.png" width="16" height="16" alt="Female" border="0" />'
);

$lang['signup_gender_icons'] = array(
'M' => '<img class="absmiddle" src="/gfx/icon=male.png" width="16" height="16" alt="Male" border="0" />',
'F' => '<img class="absmiddle" src="/gfx/icon=female.png" width="16" height="16" alt="Female" border="0" />'
);

$lang['signup_gender_look'] = array(
'M' => '<img class="absmiddle" src="/gfx/icon=male.png" width="16" height="16" alt="Male" border="0" />',
'F' => '<img class="absmiddle" src="/gfx/icon=female.png" width="16" height="16" alt="Female" border="0" />'
);

When this language file is uploaded, you must go into the admin panel to load the language file before the changes will reflect on the site. Looking at the attached screenshot, can someone tell me why the html tags are removed in the db?

Old Pedant
08-08-2009, 05:27 AM
What program is that a screenshot *from*??

If it's from a web-browser, then likely the utility you are using is doing the substitution, on purpose. so that you can *see* the tags. But then somebody goofed and went overboard.

It that's a standalone executable program, then it's pretty mysterious.

The better question would be: What does the data look like when *YOU* retrieve it in your code???

Of course, the other possibility is that whatever page you are using to store the data is doing the transform before putting the text into the DB.

Unless you coded it all yourself, how would you know without testing?

Daniellez
08-08-2009, 06:05 AM
The screenshot is from PHPMyAdmin.

The img code is displaying on the site as this:

&lt;img class=&quot;absmiddle&quot; src=&quot;/gfx/icon=female.png&quot; width=&quot;16&quot; height=&quot;16&quot; alt=&quot;Female&quot; border=&quot;0&quot; /&gt;

Old Pedant
08-08-2009, 07:01 AM
Well, has to be whatever is storing the data, then.

Old Pedant
08-08-2009, 07:16 AM
What *is* storing the data? I gather it's not code you wrote.