Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Registration extends CI_Controller {
- public function __construct(){
- parent::__construct();
- $this->load->library('form_validation');
- $this->load->helper('url');
- }
- public function index(){
- $this->load->view('view_registration');
- }
- public function aksi_daftar(){
- //1. menetapkan rulesnya
- $this->form_validation->set_rules('firstname', 'Student first name', 'required|alpha', array('required'=>'Kolom %s tidak boleh kosong.', 'alpha'=>'Kolom %s hanya boleh karakter huruf.'));
- $this->form_validation->set_rules('middlename', 'Student middle name', 'required|alpha', array('required'=>'Kolom %s tidak boleh kosong', 'alpha'=>'Kolom %s hanya boleh karakter huruf.'));
- $this->form_validation->set_rules('lastname', 'Student last name', 'required|alpha', array('required'=>'Kolom %s tidak boleh kosong.', 'alpha'=>'Kolom %s hanya boleh karakter huruf.'));
- $this->form_validation->set_rules('gender', 'Student gender', 'required', array('required'=>'Harus memilih salah satu'));
- $this->form_validation->set_rules('email', 'Student Email', 'required|valid_email', array('required'=>'Kolom %s tidak boleh kosong.', 'valid_email'=>'email yang anda masukan tidak valid'));
- $this->form_validation->set_rules('pob', 'Student place of birth', 'required|alpha', array('required'=>'Kolom %s tidak boleh kosong.','alpha'=>'kolom %s hanya boleh karakter huruf'));
- $this->form_validation->set_rules('dob', 'Student date of birth', 'required', array('required'=>'Kolom %s tidak boleh kosong.'));
- $this->form_validation->set_rules('address', 'Student address', 'required', array('required'=>'Kolom %s tidak boleh kosong.'));
- $this->form_validation->set_rules('province', 'Student province', 'required', array('required'=>'Kolom %s tidak boleh kosong.'));
- $this->form_validation->set_rules('districts', 'Student districts', 'required|alpha_numeric_spaces', array('required'=>'Kolom %s tidak boleh kosong.'));
- $this->form_validation->set_rules('postalcode', 'Student postal code', 'required|numeric', array('required'=>'Kolom %s tidak boleh kosong.','numeric'=>'Kolom %s hanya boleh karakter angka'));
- $this->form_validation->set_rules('phoneno', 'Student phone number', 'required|numeric|max_length[12]', array('required'=>'Kolom %s tidak boleh kosong.', 'numeric'=>'kolom %s hanya boleh karakter angka', 'max_length'=>'jumlah nomor melebihi batas maksimum'));
- $this->form_validation->set_rules('fathername', 'Father Name', 'required|regex_match[/^[A-Z ]+$/i]', array('required'=>'Kolom %s tidak boleh kosong.', 'regex_match'=>'Kolom %s tidak boleh karakter angka'));
- $this->form_validation->set_rules('fatheroccupation', 'Father Occupation', 'required', array('required'=>'Kolom %s tidak boleh kosong.'));
- $this->form_validation->set_rules('fatherphoneno', 'Father phone number', 'required|numeric|max_length[12]', array('required'=>'Kolom %s tidak boleh kosong.', 'numeric'=>'kolom %s hanya boleh karakter angka', 'max_length'=>'jumlah nomor melebihi batas'));
- $this->form_validation->set_rules('mothername', 'Mother Name', 'required|regex_match[/^[A-Z ]+$/i]', array('required'=>'Kolom %s tidak boleh kosong.', 'regex_match'=>'Kolom %s tidak boleh karakter angka'));
- $this->form_validation->set_rules('motheroccupation', 'Mother Occupation', 'required', array('required'=>'Kolom %s tidak boleh kosong.'));
- $this->form_validation->set_rules('motherphoneno', 'Mother phone number', 'required|numeric|max_length[12]', array('required'=>'Kolom %s tidak boleh kosong.','numeric'=>'kolom %s hanya boleh karakter angka', 'max_length'=>'jumlah nomor melebihi batas'));
- $this->form_validation->set_rules('parentaddress', 'Parent Address', 'required', array('required'=>'Kolom %s tidak boleh kosong.'));
- //cek form
- if($this->form_validation->run() == false){
- $this->load->view('view_registration');
- }
- else{
- $this->load->view('view_sukses_registration');
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement