Much like fashion models, it seems that managing CodeIgniter models can be a little tricky. I always ended up with a massive pile of set_value() calls for each of the elements I wanted to load in. In order to ‘bosh this, I wrote this function to do it automagically.
It will grab all the variables you’ve declared for the model, then try to load them up with submitted data. Nifty.
function load_model() { $vars = get_class_vars(get_class($this)); unset($vars['_parent_name']); foreach($vars as $key => $value) { $this->$key = $this->input->post($key); } }

