anjhar

contoh.php

Feb 10th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. <?php
  2. class Contoh extends CI_Controller{
  3. function __construct(){
  4. parent::__construct();
  5. $this->load->helper('form');
  6. $this->load->library('form_validation');
  7. }
  8. function index(){
  9. $this->load->view('contoh_form');
  10. } //end of class
  11.  
  12. function proses(){
  13. $this->form_validation->set_rules('namalengkap','Nama Lengkap','required');
  14. $this->form_validation>set_rules('alamat','Alamat','required');
  15. $this->form_validation->set_rules('jenkel','Jenis Kelamin','required');
  16. $this->form_validation>set_rules('agama','Agama','required');
  17. $this->form_validation->set_rules('hobi','Hobi Anda','required');
  18.  
  19. //untuk mengubah pesan error ke bahasa Indonesia / yg kita inginkan.
  20.  
  21. $this->form_validation->set_message('required','%s tidak boleh kosong');
  22. if($this->form_validation->run() == FALSE){
  23. $this->load->view('contoh_form');
  24. }else{
  25. echo "Sukses!!";
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment