public function save() { $fridge_id = $this->input->post('fridge_id'); //Check if we are in editing mode first; if so, retrieve the edited record. if not, create a new one! if (strlen($fridge_id) > 0) { $fridge = Fridges::getFridge($fridge_id); } else { $fridge = new Fridges(); } $fridge->Item_Type = $this->input->post('item_type'); $fridge->Library_Id = $this->input->post('library_id'); $fridge->PQS = $this->input->post('pqs'); $fridge->Model_Name = $this->input->post('model'); $fridge->Manufacturer = $this->input->post('manufacturer'); $fridge->Power_Source = $this->input->post('power_source'); $fridge->Refrigerant_Gas_Type = $this->input->post('gas_type'); $fridge->Net_Vol_4deg = $this->input->post('net_vol_4deg'); $fridge->Net_Vol_Minus_20deg = $this->input->post('net_vol_minus_20deg'); $fridge->Freezing_Capacity = $this->input->post('freezing_capacity'); $fridge->Gross_Vol_4deg = $this->input->post('gross_vol_4deg'); $fridge->Gross_Vol_Minus_20deg = $this->input->post('gross_vol_minus_20deg'); $fridge->Price = $this->input->post('price'); $fridge->Elec_To_Run = $this->input->post('electricity'); $fridge->Gas_To_Run = $this->input->post('gas'); $fridge->Kerosene_To_Run = $this->input->post('kerosene'); $fridge->Zone = $this->input->post('zone'); $fridge->save(); redirect("fridge_management"); }