• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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't" in my textarea while I've got no problem if I don't use the functions form_input() and form_textarea().
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.