开发者

codeigniter - pass all form values to model

开发者 https://www.devze.com 2022-12-26 20:55 出处:网络
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.

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消