Welcome Guest, Not a member yet? Register   Sign In
how to pass ALL form parameters to model
#1

[eluser]pck76[/eluser]
Hi,

I have a registration form that collects several info that should be inserted in the db, including a confirmation code generated by the controller.

I'm new to CI but understand this should be done by the model, but I don't know how to pass ALL the data from the post to the model.

can I do something like

Code:
$this->modelname->insertInDb($this->input->post(), $confirmation_code);
?

I would like to avoid to have to pass all params manually (eg $this->input->post('name'), $this->input->post('surname'), ....)

any trick?
#2

[eluser]DynamiteN[/eluser]
maybe try something like
Code:
$input = trim($this->input->post('title'));
$data = array(
    'title' => $input
         );
$this->modelname->modelFunction($data, $confirmation_code)

jsut put in the modelfunction name, something like
Code:
function modelfunction($data, $confirmation_code) { //the code }

OR something like that, maybe u can clean that up your self Smile




Theme © iAndrew 2016 - Forum software by © MyBB