unexpected $this->input->post behavior - 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: unexpected $this->input->post behavior (/showthread.php?tid=61152) |
unexpected $this->input->post behavior - El Forum - 10-02-2014 [eluser]RobertSF[/eluser] I'm using an array for my form fields. I've set validation rules according to the manual, and both form_error() and set_value() are working as expected. However, after I submit the form and run the validation successfully, I'm having trouble retrieving the values through the Input class. When I execute this code: Code: if ($this->form_validation->run()) I get this result: Code: array That is to say, I can retrieve the entire post array, and I can retrieve an array in the post array, but I can't seem retrieve elements from an array in the post array. I've tried various combinations like, Code: var_dump($this->input->post('glist['name']')); What is the correct way to retrieve array elements from the post array through the Input class? unexpected $this->input->post behavior - El Forum - 10-02-2014 [eluser]CroNiX[/eluser] Code: $glist = $this->input->post('glist'); unexpected $this->input->post behavior - El Forum - 10-02-2014 [eluser]RobertSF[/eluser] Thanks. I discovered this isn't a Codeigniter issue since you also can't retrieve array elements directly from the $_POST variable. Code: var_dump($_POST); // this works The last line of code returns an error: Quote:Severity: Notice I'd never run into that because I'd never put arrays on the $_POST variable. Looks like Codeigniter makes you try more adventuresome things. unexpected $this->input->post behavior - El Forum - 10-03-2014 [eluser]InsiteFX[/eluser] Code: $data = $this->input->post(NULL, TRUE); Returns all input post to $data. |