mudzlam

blank

Aug 27th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.60 KB | None | 0 0
  1.     function addHumanProses()
  2.     {
  3.         // set common properties
  4.         $data['action'] = site_url('welcome/addHumanProses');
  5.        
  6.         // set empty default form field values
  7.         $this->_set_fieldsDriver();
  8.         // set validation properties
  9.         $this->_set_rulesDriver();
  10.        
  11.         $config['upload_path'] = './uploads/';
  12.         $config['allowed_types'] ='gif|jpg|png';
  13.         $config['max_size'] = '5000000';
  14.         $config['max_width'] ='1600';
  15.         $config['max_height'] = '850';
  16.  
  17.         $this->load->library('upload',$config);
  18.         if ( ! $this->upload->do_upload())
  19.         {
  20.             $data = array('error' => $this->upload->display_errors());
  21.             $this->load->view('header');
  22.             $this->load->view('body-left');
  23.             $this->load->view('body-center');
  24.             $this->load->view('addHuman', $data);
  25.             $this->load->view('information');
  26.             $this->load->view('body-right');
  27.             $this->load->view('footer');
  28.         }
  29.  
  30.         else
  31.         {
  32.             $data =array('upload_data' => $this->upload->data());
  33.  
  34.  
  35.             $this->load->helper('form');
  36.             $this->load->helper('html');
  37.             $this->load->model('person_model');
  38.                
  39.             if($this->form_validation->run() == FALSE)
  40.             {
  41.                 $this->load->model('person_model');
  42.                
  43.                 if($query = $this->person_model->saveDriver())
  44.                 {              
  45.                     $data['message'] = '<div class="success">add new person success</div>';
  46.                     $this->load->view('header');
  47.                     $this->load->view('body-left');
  48.                     $this->load->view('body-center');
  49.                     $this->load->view('addHuman', $data);
  50.                     $this->load->view('information');
  51.                     $this->load->view('body-right');
  52.                     $this->load->view('footer');
  53.                 }
  54.                 else
  55.                 {
  56.                     $this->addHuman();         
  57.                 }                  
  58.             }
  59.         }
  60.     }
Advertisement
Add Comment
Please, Sign In to add comment