Last active
January 14, 2019 12:56
-
-
Save sakukode/9c65baf633f8545bb9ae3140dd18b79e to your computer and use it in GitHub Desktop.
File Controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| defined('BASEPATH') OR exit('No direct script access allowed'); | |
| class Toastr extends CI_Controller { | |
| public function __construct() | |
| { | |
| parent::__construct(); | |
| $this->load->library('session'); | |
| $this->load->helper('url'); | |
| } | |
| /** | |
| * Menampilkan form | |
| * @return [type] [description] | |
| */ | |
| public function index() | |
| { | |
| $this->load->view('demo/toastr'); | |
| } | |
| /** | |
| * Memproses action dari form | |
| * Mengambil variabel nama dari input name | |
| * Mengeset pesan/notifikasi untuk nantinya ditampilkan dengan toastr pada view | |
| * @return [type] [description] | |
| */ | |
| public function post() | |
| { | |
| //get name from input | |
| $name = $this->input->post('name'); | |
| //set sucess message using flashdata | |
| $this->session->set_flashdata('success', 'Selamat datang, '.$name); | |
| redirect('toastr'); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment