CodeIgniter Forums
Help creating a class variable from post info - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Help creating a class variable from post info (/showthread.php?tid=12622)



Help creating a class variable from post info - El Forum - 10-25-2008

[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.