Welcome Guest, Not a member yet? Register   Sign In
problem of char with form_input() and form_textarea()
#1

Hello,

I am making a simple form but I'm getting special chars in my input with the functions form_input() and form_textarea()...

like ' for hyphens... I enter an array inside it as


Code:
$message=['name'=>'message', 'id'=>'message', 'value'=> set_value("message",$form_message), 'row'=>'10', 'style'=>'height:100%'];
echo form_textarea($message);

I don't succed escaping htmlspecialchars... If I put "I don't" in my field, I get "I don[font=Tahoma, Verdana, Arial, sans-serif]'t" in my textarea while I've got no problem if I don't use the functions form_input() and form_textarea().[/font]
How can I fix this ? Do I have to escape this char with addslashes() somewhere ? or remove it by adding something ? 

Thank you for any help
Reply
#2

Oh... I've found my answer here :
https://forum.codeigniter.com/thread-68257.html

-> if you use set_value() AND form_input(), you should use set_value('var', $projets['var'] FALSE) because both functions "escape" the value.
You can turn off html escaping in set_value, by adding a third parameter.

Thanks again to nunenthal !
Reply




Theme © iAndrew 2016 - Forum software by © MyBB