tags:

views:

71

answers:

1

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)?
+1  A: 

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);
Billiam
yes that was a typo thanks, i will correct it now. it seems that the model is able to access post data without even sending that. eg if I call $this->model->register(), I can still access $this->input->post('name')is this normal?
Patrick
That's normal. If you look at system/libraries/Input.php, you can see that input->post() just returns data from the $_POST superglobal, which is available to the model as well.
Billiam