Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Contoh extends CI_Controller{
- function __construct(){
- parent::__construct();
- $this->load->helper('form');
- $this->load->library('form_validation');
- }
- function index(){
- $this->load->view('contoh_form');
- } //end of class
- function proses(){
- $this->form_validation->set_rules('namalengkap','Nama Lengkap','required');
- $this->form_validation>set_rules('alamat','Alamat','required');
- $this->form_validation->set_rules('jenkel','Jenis Kelamin','required');
- $this->form_validation>set_rules('agama','Agama','required');
- $this->form_validation->set_rules('hobi','Hobi Anda','required');
- //untuk mengubah pesan error ke bahasa Indonesia / yg kita inginkan.
- $this->form_validation->set_message('required','%s tidak boleh kosong');
- if($this->form_validation->run() == FALSE){
- $this->load->view('contoh_form');
- }else{
- echo "Sukses!!";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment