[Solved] Model Function Not Working With Array Post - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: [Solved] Model Function Not Working With Array Post (/showthread.php?tid=61843) |
[Solved] Model Function Not Working With Array Post - wolfgang1983 - 05-23-2015 I am trying to update my $this->input->post('page'); array. But for some reason when It updates It updates blank. I have var_dumped the post and is correct. PHP Code: array(3) { ["page"]=> array(3) { [1]=> array(1) { ["page_name"]=> string(20) "Controller Example 1" } [2]=> array(1) { ["page_description"]=> string(4) "Test" } [3]=> array(1) { ["page_status"]=> string(1) "1" } } ["page_content"]=> array(1) { [0]=> array(2) { ["content_name"]=> string(9) "Example 1" ["content_text"]=> string(18) "Example 1 Textarea" } } ["popup_image"]=> array(1) { [0]=> array(2) { ["image"]=> string(10) "family.png" ["popup_image_id"]=> string(4) "2407" } } } I am not sure why is updating with blank data. Its something to do with model function I think PHP Code: <?php View PHP Code: <?php $data = array('class' => 'form-horizontal'); Model Function PHP Code: public function page_update($page_id, $data) { Any Suggestion RE: Model Function Not WOrking - klassev - 05-23-2015 if ($this->form_validation->run($this) == FALSE) $this - there is such a configuration? PHP Code: if ($this->form_validation->run() == FALSE) is not it supposed to be? RE: Model Function Not Working With Array Post - wolfgang1983 - 05-24-2015 You have got to love the http://php.net/ website have been reading on $_POST section I found out what I was doing wrong. I had different numbers in the middle part of post. I had Code: name="page[1][page_name]" & name="page[2][page_description] & name="page[3][page_status]" It should of been with the second part number all should of been the same. Code: name="page[0][page_name]" & name="page[0][page_description]" & name="page[0][page_status]" http://php.net/manual/en/reserved.variables.post.php Very good reading. RE: [Solved] Model Function Not Working With Array Post - wolfgang1983 - 05-24-2015 (05-23-2015, 10:33 PM)klassev Wrote: if ($this->form_validation->run($this) == FALSE) If you use HMVC you need it for MY_Form_Validation Other Wise Sometimes Callbacks do not work with HMVC PHP Code: <?php |