Welcome Guest, Not a member yet? Register   Sign In
insert not working.
#9

[eluser]reghan[/eluser]
Code:
function add_sys(){


         // set common properties

         $data['title'] = 'Add New System';



  



  
  // set common properties
   $data['title'] = 'Add a new system';
   $data['message'] = '';
   $data['action'] = site_url('bia/addSystem');
   $data['link_back'] = anchor('bia/systems/','Back to list of systems',array('class'=>'back'));

   //load the add system view.
   $this->load->view('systemEdit', $data);

     }

function addSystem()
{
  
  
  // set common properties
  $data['title'] = 'Add new system';
  $data['action'] = site_url('bia/addSystem');
  $data['link_back'] = anchor('bia/systems/','Back to list of persons',array('class'=>'back'));
  
  //set validation rules
  $this->form_validation->set_rules('sysname', 'System Name', 'required');
  $this->form_validation->set_rules('server','Server Name', 'required');
  $this->form_validation->set_rules('ha', 'HA','required');
  $this->form_validation->set_rules('dr', 'DR','required');
  $this->form_validation->set_rules('descrip','Description', 'required');
  $this->form_validation->set_rules('class','Class', 'required');
  $this->form_validation->set_rules('lowRTO','Lowest RTO', 'required|numeric');
  $this->form_validation->set_rules('lowProcess','Lowest RTO Process', 'required');
  $this->form_validation->set_rules('lowDept','Lowest RTO Department', 'required');
  
  //set rule messages
  $this->form_validation->set_message('required', '* required');
  $this->form_validation->set_message('numeric', '* Must be numeric');
  
  
   if ($this->form_validation->run() == FALSE)
   {
  
              $data['message'] = validation_errors();
   }
  
  else
  {
   // save data
   $system = array('SystemName' => $this->input->post('sysname'),
     'Servers' => $this->input->post('server'),
     'HA' => $this->input->post('ha'),
     'DR' => $this->input->post('dr'),
     'Desc' => $this->input->post('descrip'),
     'Class' => $this->input->post('class'),
     'LowestRTO' => $this->input->post('lowRTO'),
     'LowestRTOProcess' => $this->input->post('lowProcess'),
     'LowestRTODept' => $this->input->post('lowDept'));
  
  
     $this->department_model->saveSystem($system);
    // set user message
   $data['message'] = '<div class="success">add new person success</div>';
   }
  
  
  
  
   // load view
  $this->load->view('systemEdit', $data);


  
}


Messages In This Thread
insert not working. - by El Forum - 06-11-2012, 11:29 AM
insert not working. - by El Forum - 06-11-2012, 11:55 AM
insert not working. - by El Forum - 06-11-2012, 12:01 PM
insert not working. - by El Forum - 06-11-2012, 12:03 PM
insert not working. - by El Forum - 06-11-2012, 12:05 PM
insert not working. - by El Forum - 06-11-2012, 12:10 PM
insert not working. - by El Forum - 06-11-2012, 12:12 PM
insert not working. - by El Forum - 06-11-2012, 12:14 PM
insert not working. - by El Forum - 06-11-2012, 12:16 PM
insert not working. - by El Forum - 06-11-2012, 12:17 PM
insert not working. - by El Forum - 06-11-2012, 12:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB