codeigniter - pass all form values to model
I have a registration form that collects several parameters.
i need to pass all these AND a confirmation code (generated by the controller) to the model for inserting in the DB.
How can I do that?
is there a 开发者_高级运维way to pass the whole post to the model, eg like
$this->model->insert($this->input->post(), $confirmation_code)?
I think you want
$this->input->post()
instead of
$this->input->form()
You could send the data to the model the way you have it there, where model->insert is a function like
function insert($post_array,$confirmation_code) {
//do something with confirmation code and post
}
Or you could set confirmation code in the array that gets sent to the model
$post = $this->input->post();
$post['confirmation_code'] = $confirmation_code;
$this->model->insert($post);
精彩评论