Welcome Guest, Not a member yet? Register   Sign In
Quote in form validation
#1

[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...
#2

[eluser]jairoh_[/eluser]
just use str_replace
#3

[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"
to
Code:
hello " you "
and will return false....




Theme © iAndrew 2016 - Forum software by © MyBB