this->input() as array? - 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: this->input() as array? (/showthread.php?tid=4684) |
this->input() as array? - El Forum - 12-10-2007 [eluser]A.M.F[/eluser] hello everybody, i am trying to build a three-steps registration. each time a user finish to complete one form he is redirecting to the next one. so, each time when he submit one form, i want to insert the data to sessions (so the user would be able to go back in the forms and change his data if he wants to). so, how can i put the data of the inputs or the validation fields inside a session? (i don't want to use $_POST) thank u! -btw: is there any simpler way u seguesst? this->input() as array? - El Forum - 12-10-2007 [eluser]Michael Wales[/eluser] Code: $this->session->set_userdata(array('answer1'=>$this->input->post('answer1'), 'answer2'=>$this->input->post('answer2'))); this->input() as array? - El Forum - 12-10-2007 [eluser]A.M.F[/eluser] [quote author="Michael Wales" date="1197338188"] Code: $this->session->set_userdata(array('answer1'=>$this->input->post('answer1'), 'answer2'=>$this->input->post('answer2'))); isn't there a way just to put one name of an array like this: Code: $this->session->set_userdata($_POST) this->input() as array? - El Forum - 12-11-2007 [eluser]A.M.F[/eluser] thx for the help but in the end i did a function that get's $_POST as an array and puts this array after beeing secured inside another array, and then i am putting it inside a sesion. like this: Code: function make_arr_session($arr, $name) this->input() as array? - El Forum - 12-11-2007 [eluser]Michael Wales[/eluser] I'm not really sure how that is anymore secure... all you are doing is providing one more layer of arrays to dive through. If someone were to submit a bogus form, their field/values would still be submitted and inserted into the session. Maybe something like this: Code: function make_arr_session($arr, $name) This way - the only thing going into the session is what you pre-approve and are expecting from the form. this->input() as array? - El Forum - 12-11-2007 [eluser]A.M.F[/eluser] thank u, u helped me. before i saw ur reply i rewrite my function and it was like this: Code: function make_arr_session($arr, $name, $trash = '') but then i saw (thanks to u) that instead of using foreach twice, i can just use in_array. thank u! |