Welcome Guest, Not a member yet? Register   Sign In
shot me - html isn't decode - WHY?
#1

[eluser]Jan_1[/eluser]
getting really mad... could you please help me?

my input in input field is ' รถ ' for example.
so I get an ' & o u m l ; ' in my db-table-field. that's correct.
but I don't get it decoded back. not with or without html_entity_decode().
it just gives me ' & o u m l ; ' back.
am I blind? why that suddendly?

view
Code:
<?php echo html_entity_decode($profil->detail); ?>
view form
Code:
<input type='text' name='detail' value="<?php echo set_value('detail', $profil->detail); ?>">
<?=form_error('detail')?>

model
Code:
$update['detail'] = htmlentities($this->input->post('detail'));

db
Code:
`detail` text collate utf8_unicode_ci NOT NULL,
PHP-Version: 5.2.6
#2

[eluser]mddd[/eluser]
Suggestion 1:
Don't store your information in html encoding in the database. Why? My opinion is you should only encode it when applicable. That is, when you ouput it into a html page. If you need the information for some other purpose, it is clumsy if it is already encoded. As you are experiencing right now.

Suggestion 2:
If you do want to encode/decode, make sure you specify the character set as the third parameter in the function, e.g. $encoded = htmlentities($string, ENT_COMPAT, 'UTF-8');




Theme © iAndrew 2016 - Forum software by © MyBB