Quote in form validation - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Quote in form validation (/showthread.php?tid=58712) |
Quote in form validation - El Forum - 07-11-2013 [eluser]promo[/eluser] Hello everybody I need some help with CI Validation rules.... with simple and double quotes. I want to convert " & ' in html entities when the values are submitted in database. I tested differents way but when my data is converted and when I'm trying to submit the same string, the returned value is like #039; in my input tag. Someone has a solution ? Thanks Note : I used set_value() on input type="text", I removed all htmlspecialchar in set_rules and data array input... Quote in form validation - El Forum - 07-11-2013 [eluser]jairoh_[/eluser] just use str_replace Quote in form validation - El Forum - 07-11-2013 [eluser]promo[/eluser] Hum str_replace in the form juste before set_value() ? I used Code: $this->form_validation->set_rules('name', 'Nom', 'trim|htmlspecialchars|required|is_unique[cmd_editors.editors_name]|'); But when name is already in database, the double quotes are displayed as " in the input name. So I think it's maybe a CI configuration/used function use mistake ? In documentation Quote:Note: You will generally want to use the prepping functions after the validation rules so if there is an error, the original data will be shown in the form. But if I use prepping function after validation, my result will be edited before insert in the database thus when I will resubmit the same value, the is_unique function will not run. is_unique will compare Code: hello "you" Code: hello " you " |