Buat controller Admin.php dalam folder controllers, tulis kode dibawah

143 51 52 53 54 55 56 57 tda href = class = btn btn- info Update atd tda href = class = btn btn- danger Hapus atd tr tr ?php nomer ++? ?php endforeach ? tbody table div ... kode sesudah ... 5. Akses web dengan URL http:localhostmyproyekindex.phpadmin 6. Jalankan program tampilkan dan analisa hasilnya

4. Membangun form tambah artikel pada halaman admin:

1. Buka file form_artikel.html, rubah beberapa kode seperti dibawah ini, simpan dengan nama form_artikel.php dalam folder application views C:xampphtdocsmyproyekapplication 1 2 3 4 5 6 7 8 9 10 52 53 54 55 56 57 58 59 60 DOCTYPE html html lang = en head meta charset = utf-8 meta name = viewport content = width=device-width, initial-scale=1 title Dashboard Admin title -- Bootstrap core CSS -- link href = ?php echo base_url ? assetscssbootstrap.min.css rel = stylesheet link href = ?php echo base_url ? assetsstyledashboard.css rel = stylesheet head ... kode antara ... form action = ?php echo base_url ? index.phpadmindo_tambah method = POST div class = form-group label Judul Artikel label input type = text name = judul class = form- control placeholder = Judul artikel div div class = form-group label Konten label textarea name = konten class = form- control rows = 12 textarea div button type = submit class = btn btn-primary Simpan button button type = submit class = btn btn-danger Cancel button form

2. Tambahkan kode seperti dibawah ini dalam class Admin file Admin.php

144 3. Jalankan program dan tampilkan serta analisis hasilnya

5. Membangun form update artikel pada halaman admin:

1. Buka file form_update.html, ubah beberapa kode seperti dibawah ini, simpan dengan nama form_update.php dalam folder application views C:xampphtdocsmyproyekapplication 1 2 3 4 5 6 7 8 9 10 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 DOCTYPE html html lang = en head meta charset = utf-8 meta name = viewport content = width=device-width, initial-scale=1 title Dashboard Admin title -- Bootstrap core CSS -- link href = ?php echo base_url ? assetscssbootstrap.min.css rel = stylesheet link href = ?php echo base_url ? assetsstyledashboard.css rel = stylesheet head ... kode antara ... ?php foreach artikel as data_artikel :? form action = ?php echo base_url ? index.phpadmindo_update method = POST div class = form-group input name = id type = hidden class = form- control value = ?php echo data_artikel - id ;? div div class = form-group label Judul Artikel label input name = judul type = text class = form- control placeholder = Judul Artikel value = ?php echo data_artikel - judul ;? div div class = form-group label Konten label textarea name = konten class = form- control rows = 12 ?php echo data_artikel - konten ;? textarea div label label button type = submit class = btn btn-info Update button button type = submit class = btn btn-danger Cancel button form ?php endforeach ?

2. Tambahkan kode seperti dibawah ini dalam class Admin file Admin.php

C:xampphtdocsmyproyekapplication 1 2 3 4 5 publicfunction update_artikel id { this - load - model web_model ; data [ artikel ]= this - web_model - get_for_update id ; this - load - view form_update , data ; }