Welcome Guest, Not a member yet? Register   Sign In
Help creating a class variable from post info
#1

[eluser]opel[/eluser]
I am trying still new to CI and not sure the best way to do the following.

I want set a global $data variable in my models that I can use for add and edit functions such as this :

Code:
$data = array('title' => $_POST['title'],
                    'order' => $_POST['order'],
                    'file' => $_POST['file'] );

However setting in in a variable, public or private throws up errors.

I have also tried using : $this->input->post('variable'); but I couldn't get it to work.

My aim is to use the a $data and $id variable in functions such as this :

Code:
function update()
    {    
      $this->db->where('id', $this->id);    
      $this->db->update($this->table, $this->data);

    }


Any advice would be appreciated.




Theme © iAndrew 2016 - Forum software by © MyBB