Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function edit($id)
- {
- $this->load->library('form_validation');
- $this->form_validation->set_rules('fullname', 'Name', 'required');
- $this->form_validation->set_rules('username', 'Username', 'required|min_length[5]|is_unique[user.username]');
- $this->form_validation->set_rules('password', 'Password', 'required|min_length[5]');
- $this->form_validation->set_rules(
- 'passconf',
- 'Konfirmasi Password',
- 'required|matches[password]',
- array('matches' => '%s tidak sesuai dengan password')
- );
- $this->form_validation->set_rules('level', 'Level', 'required');
- $this->form_validation->set_message('required', '%s masih kosong, silahkan isi');
- $this->form_validation->set_message('min_length', '{field} minimal 5 karakter');
- $this->form_validation->set_message('is_unique', '{field} ini sudah dipakai, silahkan ganti');
- $this->form_validation->set_error_delimiters('<span class="help-block">', '</span>');
- if ($this->form_validation->run() == FALSE) {
- $this->template->load('template', 'user/user_form_edit');
- } else {
- $post = $this->input->post(null, TRUE);
- $this->user_m->edit($post);
- if ($this->db->affected_rows() > 0) {
- echo "<scirpt>alert('Data berhasil disimpan');</script>";
- }
- echo "<script>window.location='" . site_url('user') . "';</script>";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement