Skip to content Skip to sidebar Skip to footer

Tutorial on Creating a Web Course Registration Using Codeigniter: CRUD Participant Data [Bagian 17]

The previous article has described the first task of the administrator website course registration to set the available schedule.

Another task of the admin is to check the data of participants who will take the course material. To remind the material about the manufacturing process website this registration, the author has given link articles available below.

Read also:

HOW TO SHOW, EDIT AND DELETE PARTICIPANT DATA

1. Add the following code in files welcome.php contained in folder C:\xampp\htdocs\inwepo\application\controllers\admin.

 function peserta()  {    $query = $this->admin_peserta->selectAll();    $data['peserta']=$query;    $user = $this->session->userdata('username');    $this->data['pengguna'] = $this->m_login->data($user);    $this->load->view('admin/header',$this->data);    $this->load->view('admin/peserta',$data);    $this->load->view('admin/footer');  }  function hapus_ps($id)  {        $this->admin_peserta->delete($id);        redirect('admin/welcome/peserta');  }  function ubah_ps($id)   {         if($_POST==NULL) {            $data['peserta'] = $this->admin_peserta->select($id);            $user = $this->session->userdata('username');            $this->data['pengguna'] = $this->m_login->data($user);            $this->load->view('admin/header',$this->data);            $this->load->view('admin/edit_peserta',$data);            $this->load->view('admin/footer');        }else {            $npm=$this->input->post('npm');            $nama=$this->input->post('nama');            $nm_kursus=$this->input->post('nm_kursus');            $periode=$this->input->post('periode');            $kelas=$this->input->post('kelas');            $jurusan=$this->input->post('jurusan');            $this->admin_peserta->update($id,$npm,$nama,$nm_kursus,$periode,$kelas,$jurusan);             redirect('admin/welcome/peserta');        }  }

2. Make files admin_participant.php in the folder C:\xampp\htdocs\inwepo\application\models.

db->order_by("id","asc");	return $this->db->get('peserta')->result();}function delete($id) {	$this->db->delete('peserta', array('id'=>$id));}function update($id,$npm,$nama,$nm_kursus,$periode,$kelas,$jurusan){	$data = array(	'npm'=>$npm,	'nama'=>$nama,	'nm_kursus'=>$nm_kursus,	'periode'=>$periode,	'kelas'=>$kelas,	'jurusan'=>$jurusan,	);	$this->db->where('id',$id)->update('peserta', $data);}function select($id) {	return $this->db->get_where('peserta', array('id'=>$id))->row();}}

3. Creating views participant.php to display the data of participants who have registered the desired course material in the folder C:\xampp\htdocs\inwepo\application\views\admin.

So when the URL is opened http://localhost/inwepo/admin/welcome/participants a page like this will appear:

4. Creating views edit_participant.php to display the data of participants who have registered the desired course material in the folder C:\xampp\htdocs\inwepo\application\views\admin.

Edit Peserta

Silahkan mengubah peserta kursus

So the admin can change the participant’s name if something goes wrong. The display for the code above will look like the image below:

The author has also prepared source code for the display above so that readers can download it. It’s also because script quite a lot of programs, so the author only includes a snippet of the program.

For the next article, the author will provide logout function on the admin dashboard. The next article will also be the last stage in creating a course registration website using the codeigniter framework.

Therefore, don’t miss it, loyal friend of Inwepo. That is all and thank you.

DOWNLOAD

welcome.php

admin_participant.php

participant.php

edit_participant.php






No NPM Nama Nama Kursus Kelas Jurusan Aksi