Welcome Guest, Not a member yet? Register   Sign In
Best method for sending form variables to a model ?
#12

[eluser]BobbyB[/eluser]
Thanks to both of you!
The following line throws the error:
Code:
$this->model->add($cat);

I tried to implement your solutions but did not manage to get it working.
I also tried passing the variable like this:

Code:
//Controller:
$this->load->model('Get_freebies');
$data = array(
    'category' => $this->input->get_post('category', TRUE)
);
$data['freebies'] = $this->Get_freebies->getselect($data);
But this gives me "Undefined variable: data" error in the model.

Mmmhhh?
Can't be that hard to just pass some data to the model can it? Smile


UPDATE:

Got it working now:
Code:
//Controller:
$category = $this->input->get_post('category', TRUE);
$this->load->model('Get_freebies');
$data['freebies'] = $this->Get_freebies->getselect($category);

//Model:
function getselect($category)//I forgot to add "$category to the function
{
...
$this->db->where('category',$category);
...
}


Messages In This Thread
Best method for sending form variables to a model ? - by El Forum - 07-22-2007, 03:44 PM
Best method for sending form variables to a model ? - by El Forum - 07-22-2007, 04:41 PM
Best method for sending form variables to a model ? - by El Forum - 07-23-2007, 11:14 AM
Best method for sending form variables to a model ? - by El Forum - 07-29-2008, 12:42 AM
Best method for sending form variables to a model ? - by El Forum - 07-29-2008, 02:26 AM
Best method for sending form variables to a model ? - by El Forum - 07-29-2008, 02:38 AM
Best method for sending form variables to a model ? - by El Forum - 07-29-2008, 02:49 AM
Best method for sending form variables to a model ? - by El Forum - 07-29-2008, 10:35 AM
Best method for sending form variables to a model ? - by El Forum - 11-25-2008, 12:05 PM
Best method for sending form variables to a model ? - by El Forum - 11-25-2008, 12:38 PM
Best method for sending form variables to a model ? - by El Forum - 11-25-2008, 12:50 PM
Best method for sending form variables to a model ? - by El Forum - 11-26-2008, 07:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB