Codeigniter multiple checkbox issue STRANGE! |
m using codeigniter and I have a very simple form, which has a few checkboxes:
Code: <input type="checkbox" name="user_assign[]" value="' . $row->user_id . '"> Code: user_assign[]100002 Code: $user_assign = $this->input->post('user_assign'); Here is the controller: PHP Code: function update_course_assignment_org() { At the moment I am just trying to get the POST vars into the controller. Its just not working. I can echo/print the POST vars no problem. But I just cannot get the POST vars into the contoller with $this->input->post('user_assign')
so... when you do a print_r($this->input->post('user_assign')); you get nothing?
I am asking this because in the controller you can't seem to use that $user_assign you are talking about... Website: http://avenir.ro
(01-07-2016, 04:05 AM)Avenirer Wrote: so... when you do a print_r($this->input->post('user_assign')); you get nothing? Thats right, its NULL, empty I've tried the following: Code: print_r($this->input->post('user_assign')) ; NULL Code: print_r( $this->input->post()); NULL Code: $user_assign = substr(implode(', ', $this->input->post('user_assign')), 0); NULL Code: foreach ($this->input->post('user_assign') as $key => $value) { NULL
This is rather impossible, unless there are no checkboxes selected (ticked).
Website: http://avenir.ro
(01-07-2016, 04:15 AM)Avenirer Wrote: This is rather impossible, unless there are no checkboxes selected (ticked). oh boy, don't I just know that. It makes absolutely no sense whatsoever. Code: print_r($_POST); above code give outputs: Code: Array ( [user_assign] => Array ( [0] => 100002 [1] => 100003 ) [course_name] => Slips & Trips ) and when i try this: Code: print_r($this->input->post('user_assign')); it outputs nothing. it empty?
I have this thread on SO been going for a while. Everybody seems to be completely stumped. I mean what the hell is going on?
http://stackoverflow.com/questions/34643...kbox-issue
I managed to get the data i wanted by using:
$assignmen = @$_POST['user_assign'];
Not a good idea, as $_POST has no validation, and @ won't show the eventual errors you may get...
Website: http://avenir.ro
|
Welcome Guest, Not a member yet? Register Sign In |