jQuery.serialize() and form_validation [solved] |
[eluser]juanchorossi[/eluser]
Hi Guys! After hours of reading the forum, I couldn't get the solution to my problem, similar to audun1's (jquery.serialize() codeigniter does not get value). The problem: I pass the form variables as a string with jQuery.serialize() function, but I can't validate those fields. The View JS: Code: function sendForm() The Controller: Code: function evento_submit() The only solution I could find was to manually set $_POST keys to the parsed ones. Is there another way? Suggestions are welcome! Thanks in advance!
[eluser]tomcode[/eluser]
parse_str() You can use if You have a (GET) query string (?a=b&c=d) which You want to transform into an array. Also, parse_str() requires a second parameter, the array to hold the resulting array. In Your case, can't You just use unserialize() ? Code: $form_params = unserialize ($this->input->post('params'));
[eluser]juanchorossi[/eluser]
Thanks! I put $_POST as second parameter on the parse_str and worked fine! Code: parse_str($this->input->post('params'), $_POST);
|
Welcome Guest, Not a member yet? Register Sign In |