Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- class Welcome extends CI_Controller {
- public function index(){
- $this->load->model('model');
- $posts = $this->model->getDb();
- $this->load->view('code',['post'=>$posts]);
- }
- public function tambah(){
- $this->load->view('tambah');
- }
- public function add(){
- $data = array(
- 'Nama'=>$this->input->post('Nama'),
- 'Alamat'=>$this->input->post('Alamat'),
- 'Email'=>$this->input->post('Email'),
- 'Jurusan'=>$this->input->post('Jurusan')
- );
- $insert = $this->db->insert('code_tb',$data);
- if ($insert > 0) {
- redirect('welcome');
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment