Advertisement
dadang9

Untitled

Oct 4th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.28 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3.  
  4. class Mahasiswa extends CI_Controller {
  5.  
  6.     public function __construct()
  7.     {
  8.         parent::__construct();
  9.         $this->load->model('mahasiswa_model');
  10.     }
  11.  
  12.     public function index()
  13.     {
  14.         $this->load->view('layouts/header');
  15.         $this->load->view('index_mahasiswa');
  16.         $this->load->view('layouts/footer');
  17.     }
  18.  
  19.     // Add a new item
  20.     public function tambah()
  21.     {
  22.         $config['upload_path']          = './assets/images/';
  23.         $config['allowed_types']        = 'gif|jpg|png';
  24.         $this->upload->initialize($config);
  25.        
  26.         $this->load->library('upload', $config);
  27.         $this->upload->do_upload('foto');
  28.         $foto = $this->upload->data();
  29.  
  30.         $nama           = $this->input->post('nama');
  31.         $jenis_kelamin  = $this->input->post('jenis_kelamin');
  32.         $tempat_lahir   = $this->input->post('tempat_lahir');
  33.         $alamat         = $this->input->post('alamat');
  34.         $password       = $this->input->post('password');
  35.  
  36.         $data = $this->mahasiswa_model->tmbhmhs_model(
  37.             $nama,
  38.             $jenis_kelamin,
  39.             $tempat_lahir,
  40.             $alamat,
  41.             $foto,
  42.             $password
  43.         );
  44.         $this->output->enable_profiler(1); 
  45.         echo '<a href="' . base_url() . '">KEMBALI</a>';
  46.     }
  47.  
  48. /* End of file mahasiswa.php */
  49. /* Location: ./application/controllers/mahasiswa.php */
  50.    
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement