Thursday, January 1, 2015

Jepretcode: Codeigniter Membuat Dropdown Provinsi Sampai Kelurahan

Codeigniter Membuat Dropdown Provinsi Sampai Kelurahan

Codeigniter Cara Membuat Dropdown Provinsi Sampai Kelurahan
Didalam input data alamat biasanya menggunakan dropdown wilayah provinsi kabupaten kecamatan hingga kelurahan, untuk memudahkan pengisian data alamat karena daftar wilayah provinsi sampai kelurahan sudah disediakan didatabase dan tinggal mengambil data wilayah kemudian disimpan didalam data baru, lihat gambar dibawah. lalu bagaimana cara membuat dropdown provinsi Kabupaten Kecamatan dan Kelurahan di codeigniter, berikut caranya sebagai contoh saya menggunakan input data alamat mahasiswa yang dilengkapi dengan :
  • Max_kode otomatis dengan mengambil nilai tertinggi lalu otomatis menambah sendiri untuk data berikutnya.
  • Count data atau menghitung jumlah data.
  • Dropdown provinsi sampai kelurahan.
  • Pagination atau membuat halaman untuk tabel 
  • Fungsi untuk delete atau penghapusan data.
Sebelum melakukan langkah dibawah ini pertama-tama harus menghilangkan index.php, dan buatlah database dengan nama "kampus" dan buat tabel dengan mengikuti kode berikut:
CREATE TABLE IF NOT EXISTS `provinsi` (
  `id_provinsi` varchar(6) NOT NULL,
  `nama_provinsi` varchar(25) NOT NULL,
  `ibukota_prov` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `provinsi` (`id_provinsi`, `nama_provinsi`, `ibukota_prov`) VALUES
('PRO-01', 'DKI Jakarta', 'Jakarta'),
('PRO-02', 'Nanggroe Aceh Darussalam', 'Banda Aceh'),
('PRO-03', 'Sumatera Utara', 'Medan'),
('PRO-04', 'Sumatera Barat', 'Padang'),
('PRO-05', 'Riau', 'Pekanbaru'),
('PRO-06', 'Jambi', 'Jambi'),
('PRO-07', 'Sumatera Selatan', 'Palembang'),
('PRO-08', 'Bengkulu', 'Bengkulu'),
('PRO-09', 'Lampung', 'Bandar Lampung'),
('PRO-10', 'Kepulauan Bangka Belitung', 'Pangkal Pinang'),
('PRO-11', 'Kepulauan Riau', 'Tanjung Pinang'),
('PRO-12', 'Yogyakarta', 'Yogyakarta'),
('PRO-13', 'Jawa Barat', 'Bandung'),
('PRO-14', 'Jawa Tengah', 'Semarang'),
('PRO-15', 'Jawa Timur', 'Surabaya'),
('PRO-16', 'Banten', 'Serang'),
('PRO-17', 'Bali', 'Denpasar'),
('PRO-18', 'Nusa Tenggara Timur', 'Kupang'),
('PRO-19', 'Nusa Tenggara Barat', 'Mataram'),
('PRO-20', 'Kalimantan Barat', 'Pontianak'),
('PRO-21', 'Kalimantan Tengah', 'Palangka Raya'),
('PRO-22', 'Kalimantan Selatan', 'Banjarmasin'),
('PRO-23', 'Kalimantan Timur', 'Samarinda'),
('PRO-24', 'Kalimantan Utara', 'Tanjung Selor'),
('PRO-25', 'Sulawesi Utara', 'Manado'),
('PRO-26', 'Sulawesi Tengah', 'Palu'),
('PRO-27', 'Sulawesi Selatan', 'Makassar'),
('PRO-28', 'Sulawesi Tenggara', 'Kendari'),
('PRO-29', 'Sulawesi Barat', 'Mamuju'),
('PRO-30', 'Gorontalo', 'Gorontalo'),
('PRO-31', 'Maluku', 'Ambon'),
('PRO-32', 'Maluku Utara', 'Sofifi'),
('PRO-33', 'Papua', 'Jayapura'),
('PRO-34', 'Papua Barat', 'Manokwari'),
('PRO-35', 'Sumbawa', 'Nusa Tengggara Barat'),
('PRO-36', 'Papua Selatan', ''),
('PRO-37', 'Papua Tengah', ''),
('PRO-38', 'Papua Barat Daya', ''),
('PRO-39', 'Tapanuli', ''),
('PRO-40', 'Kepulauan Nias', ''),
('PRO-41', 'Kapuas Raya', ''),
('PRO-42', 'Bolang Mogondow Raya', '');

CREATE TABLE IF NOT EXISTS `kabupaten` (
  `id_kab` varchar(7) NOT NULL,
  `id_prov` varchar(6) NOT NULL,
  `nama_kabupaten` varchar(55) NOT NULL,
  `pusat_pemerintahan` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `kabupaten` (`id_kab`, `id_prov`, `nama_kabupaten`, `pusat_pemerintahan`) VALUES
('KAB-001', 'PRO-01', 'Bandung', 'Soreang'),
('KAB-002', 'PRO-01', 'Bandung Barat', 'Ngamprah'),
('KAB-003', 'PRO-01', 'Bekasi', 'Cikarang'),
('KAB-004', 'PRO-01', 'Bogor', 'Cibinong'),
('KAB-005', 'PRO-01', 'Ciamis', 'Ciamis'),
('KAB-006', 'PRO-01', 'Cianjur', 'Cianjur'),
('KAB-007', 'PRO-01', 'Cirebon', 'Sumber'),
('KAB-008', 'PRO-01', 'Garut', 'Garut'),
('KAB-009', 'PRO-01', 'Indramayu', 'Indramayu'),
('KAB-010', 'PRO-01', 'Karawang', 'Karawang'),
('KAB-011', 'PRO-01', 'Kuningan', 'Kuningan'),
('KAB-012', 'PRO-01', 'Majalengka', 'Majalengka'),
('KAB-013', 'PRO-01', 'Pangandaran', 'Parigi'),
('KAB-014', 'PRO-01', ' Purwakarta', 'Purwakarta'),
('KAB-015', 'PRO-01', 'Subang', 'Subang'),
('KAB-016', 'PRO-01', 'Sukabumi', 'Palabuhan Ratu'),
('KAB-017', 'PRO-01', 'Sumedang', 'Sumedang'),
('KAB-018', 'PRO-01', 'Tasikmalaya', 'Singaparna'),
('KAB-019', 'PRO-01', 'Kota Bandung', 'Bandung'),
('KAB-020', 'PRO-01', 'Kota Banjar', 'Banjar'),
('KAB-021', 'PRO-01', 'Kota Bekasi', 'Bekasi'),
('KAB-022', 'PRO-01', 'Kota Bogor', 'Bogor'),
('KAB-023', 'PRO-01', 'Kota Cimahi', 'Cimahi'),
('KAB-024', 'PRO-01', 'Kota Cirebon', 'Cirebon'),
('KAB-025', 'PRO-01', 'Kota Depok', 'Depok'),
('KAB-026', 'PRO-01', 'Kota Sukabumi', 'Sukabumi'),
('KAB-027', 'PRO-01', 'Kota Tasikmalaya', 'Tasikmalaya'),
('KAB-028', 'PRO-01', 'Administrasi Kepulauan Seribu', 'Pulau Pramuka'),
('KAB-029', 'PRO-01', 'Kota Administrasi Jakarta Barat', 'Kebon Jeruk'),
('KAB-030', 'PRO-01', 'Kota Administrasi Jakarta Pusat', 'Menteng'),
('KAB-031', 'PRO-01', 'Kota Administrasi Jakarta Selatan', 'Kebayoran Baru'),
('KAB-032', 'PRO-01', 'Kota Administrasi Jakarta Timur', 'Jatinegara'),
('KAB-033', 'PRO-01', 'Kota Administrasi Jakarta Utara', 'Koja'),
('KAB-034', 'PRO-02', 'Aceh Barat', 'Meulaboh'),
('KAB-035', 'PRO-02', 'Aceh Barat Daya', 'Blangpidie'),
('KAB-036', 'PRO-02', 'Aceh Besar', 'Kota Jantho'),
('KAB-037', 'PRO-02', 'Aceh Jaya', 'Calang'),
('KAB-038', 'PRO-02', 'Aceh Selatan', 'Tapak Tuan'),
('KAB-039', 'PRO-02', 'Aceh Singkil', 'Singkil'),
('KAB-040', 'PRO-02', 'Aceh Tamiang', 'Karang Baru'),
('KAB-041', 'PRO-02', 'Aceh Tengah', 'Takengon'),
('KAB-042', 'PRO-02', 'Aceh Tenggara', 'Kutacane'),
('KAB-043', 'PRO-02', 'Aceh Timur', 'Idi Rayeuk'),
('KAB-044', 'PRO-02', 'Aceh Utara', 'Lhoksukon'),
('KAB-045', 'PRO-02', 'Bener Meriah', 'Sipang Tiga Redelong'),
('KAB-046', 'PRO-02', 'Bireuen', 'Bireuen'),
('KAB-047', 'PRO-02', 'Gayo Lues', 'Blang Kejeren'),
('KAB-048', 'PRO-02', 'Nagan Raya', 'Suka Makmue'),
('KAB-049', 'PRO-02', 'Pidie', 'Sigli'),
('KAB-050', 'PRO-02', 'Pidie Jaya', 'Meureudu'),
('KAB-051', 'PRO-02', 'Simeulue', 'Sinabang'),
('KAB-052', 'PRO-02', 'Kota Banda Aceh', 'Banda Aceh'),
('KAB-053', 'PRO-02', 'Kota Langsa', 'Langsa'),
('KAB-054', 'PRO-02', 'Kota Lhokseumawe', 'Lhokseumawe'),
('KAB-055', 'PRO-02', 'Kota Sabang', 'Sabang'),
('KAB-056', 'PRO-02', 'Kota Subulussalam', 'Subulussalam'),
('KAB-057', 'PRO-05', 'Bengkalis', 'Bengkalis'),
('KAB-058', 'PRO-05', 'Indragiri Hilir', 'Tembilahan'),
('KAB-059', 'PRO-05', 'Indragiri Hulu', 'Rengat'),
('KAB-060', 'PRO-05', 'Kampar', 'Bangkinang'),
('KAB-061', 'PRO-05', 'Kepulauan Meranti', 'Selat Panjang'),
('KAB-062', 'PRO-05', 'Kuantan Singingi', 'Taluk Kuantan'),
('KAB-063', 'PRO-05', 'Pelalawan', 'Pangkalan Kerinci'),
('KAB-064', 'PRO-05', 'Rokan Hilir', 'Bagan Siapi-api'),
('KAB-065', 'PRO-05', 'Rokan Hulu', 'Pasir Pangaraian'),
('KAB-066', 'PRO-05', 'Siak', 'Siak Sri Indrapura'),
('KAB-067', 'PRO-05', 'Kota Dumai', 'Dumai'),
('KAB-068', 'PRO-05', 'Kota Pekanbaru', 'Pekanbaru'),
('KAB-069', 'PRO-03', 'Asahan', 'Kisaran'),
('KAB-070', 'PRO-03', 'Batubara', 'Limapuluh'),
('KAB-071', 'PRO-03', 'Dairi', 'Sidikalang'),
('KAB-072', 'PRO-03', 'Deli Serdang', 'Lubuk Pakam'),
('KAB-073', 'PRO-03', 'Humbang Hasundutan', 'Dolok Sanggul');

CREATE TABLE IF NOT EXISTS `kecamatan` (
  `id_kecamatan` varchar(8) NOT NULL,
  `id_kab` varchar(7) NOT NULL,
  `id_prov` varchar(6) NOT NULL,
  `nama_kecamatan` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `kecamatan` (`id_kecamatan`, `id_kab`, `id_prov`, `nama_kecamatan`) VALUES
('KEC-0001', 'KAB-001', 'PRO-01', 'Arjasari'),
('KEC-0002', 'KAB-001', 'PRO-01', 'Cikancung'),
('KEC-0003', 'KAB-001', 'PRO-01', 'Ciwidey'),
('KEC-0004', 'KAB-001', 'PRO-01', 'Majalaya'),
('KEC-0005', 'KAB-001', 'PRO-01', 'Pangalengan'),
('KEC-0006', 'KAB-001', 'PRO-01', 'Soreang'),
('KEC-0007', 'KAB-001', 'PRO-01', 'Baleendah'),
('KEC-0008', 'KAB-001', 'PRO-01', 'Cilengkrang'),
('KEC-0009', 'KAB-001', 'PRO-01', 'Dayeuhkolot'),
('KEC-0010', 'KAB-001', 'PRO-01', 'Margaasih'),
('KEC-0011', 'KAB-001', 'PRO-01', 'Paseh'),
('KEC-0012', 'KAB-001', 'PRO-01', 'Banjaran'),
('KEC-0013', 'KAB-001', 'PRO-01', 'Cileunyi'),
('KEC-0014', 'KAB-001', 'PRO-01', 'Ibun'),
('KEC-0015', 'KAB-001', 'PRO-01', 'Margahayu'),
('KEC-0016', 'KAB-001', 'PRO-01', 'Pasirjambu'),
('KEC-0017', 'KAB-001', 'PRO-01', 'Bojongsoang'),
('KEC-0018', 'KAB-001', 'PRO-01', 'Cimaung'),
('KEC-0019', 'KAB-001', 'PRO-01', 'Katapang'),
('KEC-0020', 'KAB-001', 'PRO-01', 'Nagreg'),
('KEC-0021', 'KAB-001', 'PRO-01', 'Rancabali'),
('KEC-0022', 'KAB-001', 'PRO-01', 'Cangkuang'),
('KEC-0023', 'KAB-001', 'PRO-01', 'Cimenyan'),
('KEC-0024', 'KAB-001', 'PRO-01', 'Kertasari'),
('KEC-0025', 'KAB-001', 'PRO-01', 'Pacet'),
('KEC-0026', 'KAB-001', 'PRO-01', 'Solokan Jeruk'),
('KEC-0027', 'KAB-001', 'PRO-01', 'Cicalengka'),
('KEC-0028', 'KAB-001', 'PRO-01', 'Ciparay'),
('KEC-0029', 'KAB-001', 'PRO-01', 'Kutawaringin'),
('KEC-0030', 'KAB-001', 'PRO-01', 'Pameungpeuk'),
('KEC-0031', 'KAB-001', 'PRO-01', 'Rancaekek'),
('KEC-0032', 'KAB-068', 'PRO-05', 'Bukit Raya'),
('KEC-0033', 'KAB-068', 'PRO-05', 'Lima Puluh'),
('KEC-0034', 'KAB-068', 'PRO-05', 'Marpoyan Damai'),
('KEC-0035', 'KAB-068', 'PRO-05', 'Payung Sekaki'),
('KEC-0036', 'KAB-068', 'PRO-05', 'Pekanbaru Kota'),
('KEC-0037', 'KAB-068', 'PRO-05', 'Rumbai'),
('KEC-0038', 'KAB-068', 'PRO-05', 'Rumbai Pesisir'),
('KEC-0039', 'KAB-068', 'PRO-05', 'Sail'),
('KEC-0040', 'KAB-068', 'PRO-05', 'Senapelan'),
('KEC-0041', 'KAB-068', 'PRO-05', 'Sukajadi'),
('KEC-0042', 'KAB-068', 'PRO-05', 'Tampan'),
('KEC-0043', 'KAB-068', 'PRO-05', 'Tenayan Raya'),
('KEC-0046', 'KAB-002', 'PRO-01', 'Batujajar'),
('KEC-0047', 'KAB-002', 'PRO-01', 'Cipongkor'),
('KEC-0048', 'KAB-002', 'PRO-01', 'Rongga'),
('KEC-0049', 'KAB-002', 'PRO-01', 'Cikalongwetan'),
('KEC-0050', 'KAB-002', 'PRO-01', 'Cisarua'),
('KEC-0051', 'KAB-002', 'PRO-01', 'Sindangkerta'),
('KEC-0052', 'KAB-002', 'PRO-01', 'Cihampelas'),
('KEC-0053', 'KAB-002', 'PRO-01', 'Gununghalu'),
('KEC-0054', 'KAB-002', 'PRO-01', 'Lembang'),
('KEC-0055', 'KAB-002', 'PRO-01', 'Cililin'),
('KEC-0056', 'KAB-002', 'PRO-01', 'Ngamprah'),
('KEC-0057', 'KAB-002', 'PRO-01', 'Saguling'),
('KEC-0058', 'KAB-002', 'PRO-01', 'Cipatat'),
('KEC-0059', 'KAB-002', 'PRO-01', 'Padalarang'),
('KEC-0060', 'KAB-002', 'PRO-01', 'Cipeundeuy'),
('KEC-0061', 'KAB-002', 'PRO-01', 'Paronpong'),
('KEC-0062', 'KAB-060', 'PRO-05', 'XIII Koto Kampar'),
('KEC-0063', 'KAB-060', 'PRO-05', 'Tapung Hulu'),
('KEC-0064', 'KAB-060', 'PRO-05', 'Tapung Hilir'),
('KEC-0065', 'KAB-060', 'PRO-05', 'Tapung'),
('KEC-0066', 'KAB-060', 'PRO-05', 'Tambang'),
('KEC-0067', 'KAB-060', 'PRO-05', 'Siak Hulu'),
('KEC-0068', 'KAB-060', 'PRO-05', 'Salo'),
('KEC-0069', 'KAB-060', 'PRO-05', 'Rumbio Jaya'),
('KEC-0070', 'KAB-060', 'PRO-05', 'Perhentian Raja'),
('KEC-0071', 'KAB-060', 'PRO-05', 'Kuok (Bangkinang Barat)'),
('KEC-0072', 'KAB-060', 'PRO-05', 'Koto Kampar Hulu'),
('KEC-0073', 'KAB-060', 'PRO-05', 'Kampar Utara'),
('KEC-0074', 'KAB-060', 'PRO-05', 'Kampar Timur'),
('KEC-0075', 'KAB-060', 'PRO-05', 'Kampar Kiri Tengah'),
('KEC-0076', 'KAB-060', 'PRO-05', 'Kampar Kiri Hulu'),
('KEC-0077', 'KAB-060', 'PRO-05', 'Kampar Kiri Hilir'),
('KEC-0078', 'KAB-060', 'PRO-05', 'Kampar Kiri'),
('KEC-0079', 'KAB-060', 'PRO-05', 'Kampar'),
('KEC-0080', 'KAB-060', 'PRO-05', 'Gunung Sahilan'),
('KEC-0081', 'KAB-060', 'PRO-05', 'Bangkinang Seberang'),
('KEC-0082', 'KAB-060', 'PRO-05', 'Bangkinang');

CREATE TABLE IF NOT EXISTS `kelurahan` (
  `id_kelurahan` varchar(10) NOT NULL,
  `id_kecamatan` varchar(8) NOT NULL,
  `id_kab` varchar(7) NOT NULL,
  `id_prov` varchar(6) NOT NULL,
  `nama_kelurahan` varchar(100) NOT NULL,
  `kode_pos_kel` int(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `kelurahan` (`id_kelurahan`, `id_kecamatan`, `id_kab`, `id_prov`, `nama_kelurahan`, `kode_pos_kel`) VALUES
('KEL-00001', 'KEC-0032', 'KAB-068', 'PRO-05', 'Tangkerang Labuai', 28281),
('KEL-00002', 'KEC-0043', 'KAB-068', 'PRO-05', 'Kulim', 28283),
('KEL-00003', 'KEC-0032', 'KAB-068', 'PRO-05', 'Simpang Tiga', 28284),
('KEL-00004', 'KEC-0038', 'KAB-068', 'PRO-05', 'Tebing Tinggi Okura', 28287),
('KEL-00005', 'KEC-0032', 'KAB-068', 'PRO-05', 'Tangkerang Selatan', 28288),
('KEL-00006', 'KEC-0032', 'KAB-068', 'PRO-05', 'Tangkerang Utara', 28289),
('KEL-00007', 'KEC-0033', 'KAB-068', 'PRO-05', 'Rintis', 28141),
('KEL-00008', 'KEC-0033', 'KAB-068', 'PRO-05', 'Sekip', 28142),
('KEL-00009', 'KEC-0033', 'KAB-068', 'PRO-05', 'Tanjung Rhu', 28143),
('KEL-00010', 'KEC-0033', 'KAB-068', 'PRO-05', 'Pesisir', 28144),
('KEL-00011', 'KEC-0034', 'KAB-068', 'PRO-05', 'Maharatu', 28125),
('KEL-00012', 'KEC-0034', 'KAB-068', 'PRO-05', 'Sidomulyo Timur', 28125),
('KEL-00013', 'KEC-0034', 'KAB-068', 'PRO-05', 'Wonorejo', 28125),
('KEL-00014', 'KEC-0034', 'KAB-068', 'PRO-05', 'Tangkerang Barat', 28282),
('KEL-00015', 'KEC-0034', 'KAB-068', 'PRO-05', 'Tangkerang Tengah', 28282),
('KEL-00016', 'KEC-0046', 'KAB-002', 'PRO-01', 'Batujajar Barat', 40561),
('KEL-00017', 'KEC-0046', 'KAB-002', 'PRO-01', 'Batujajar Timur', 40561),
('KEL-00018', 'KEC-0046', 'KAB-002', 'PRO-01', 'Cangkorah', 40561),
('KEL-00019', 'KEC-0046', 'KAB-002', 'PRO-01', 'Galanggang', 40561),
('KEL-00020', 'KEC-0046', 'KAB-002', 'PRO-01', 'Giriasih', 40561),
('KEL-00021', 'KEC-0046', 'KAB-002', 'PRO-01', 'Pangauban', 40561),
('KEL-00022', 'KEC-0046', 'KAB-002', 'PRO-01', 'Selacau', 40561),
('KEL-00023', 'KEC-0082', 'KAB-060', 'PRO-05', 'Bangkinang (Kota)', 28411),
('KEL-00024', 'KEC-0082', 'KAB-060', 'PRO-05', 'Kumantan', 28411),
('KEL-00025', 'KEC-0082', 'KAB-060', 'PRO-05', 'Langgini', 28412),
('KEL-00026', 'KEC-0082', 'KAB-060', 'PRO-05', 'Ridan Permai', 28411),
('KEL-00027', 'KEC-0081', 'KAB-060', 'PRO-05', 'Binuang', 28463),
('KEL-00028', 'KEC-0081', 'KAB-060', 'PRO-05', 'Bukit Payung', 28463),
('KEL-00029', 'KEC-0081', 'KAB-060', 'PRO-05', 'Laboi Jaya', 28463),
('KEL-00030', 'KEC-0081', 'KAB-060', 'PRO-05', 'Muara Uwai', 28463),
('KEL-00031', 'KEC-0081', 'KAB-060', 'PRO-05', 'Pasir Sialang', 28463),
('KEL-00032', 'KEC-0081', 'KAB-060', 'PRO-05', 'Pulau', 28463),
('KEL-00033', 'KEC-0081', 'KAB-060', 'PRO-05', 'Pulau Lawas', 28463),
('KEL-00034', 'KEC-0081', 'KAB-060', 'PRO-05', 'Suka Mulya', 28463),
('KEL-00035', 'KEC-0080', 'KAB-060', 'PRO-05', 'Gunung Mulya', 28471),
('KEL-00036', 'KEC-0080', 'KAB-060', 'PRO-05', 'Gunung Sahilan', 28471),
('KEL-00037', 'KEC-0080', 'KAB-060', 'PRO-05', 'Gunung Sari', 28471),
('KEL-00038', 'KEC-0080', 'KAB-060', 'PRO-05', 'Kebun Durian', 28471),
('KEL-00039', 'KEC-0080', 'KAB-060', 'PRO-05', 'Makmur Sejahtera', 28471),
('KEL-00040', 'KEC-0080', 'KAB-060', 'PRO-05', 'Sahilan Darussalam', 28471),
('KEL-00041', 'KEC-0080', 'KAB-060', 'PRO-05', 'Subarak', 28471),
('KEL-00042', 'KEC-0080', 'KAB-060', 'PRO-05', 'Suka Makmur', 28471),
('KEL-00043', 'KEC-0080', 'KAB-060', 'PRO-05', 'Sungai Lipai', 28471),
('KEL-00044', 'KEC-0079', 'KAB-060', 'PRO-05', 'Air Tiris', 28461),
('KEL-00045', 'KEC-0079', 'KAB-060', 'PRO-05', 'Batu Belah', 28461),
('KEL-00046', 'KEC-0079', 'KAB-060', 'PRO-05', 'Bukit Ranah', 28461),
('KEL-00047', 'KEC-0079', 'KAB-060', 'PRO-05', 'Koto Tibun', 28461),
('KEL-00048', 'KEC-0079', 'KAB-060', 'PRO-05', 'Limau Manis', 28461),
('KEL-00049', 'KEC-0079', 'KAB-060', 'PRO-05', 'Naumbai', 28461),
('KEL-00050', 'KEC-0079', 'KAB-060', 'PRO-05', 'Padang Mutung', 28461),
('KEL-00051', 'KEC-0079', 'KAB-060', 'PRO-05', 'Penyasawan', 28461),
('KEL-00052', 'KEC-0079', 'KAB-060', 'PRO-05', 'Pulau Jambu', 28461),
('KEL-00053', 'KEC-0079', 'KAB-060', 'PRO-05', 'Pulau Sarak', 28461),
('KEL-00054', 'KEC-0079', 'KAB-060', 'PRO-05', 'Pulau Tinggi', 28461),
('KEL-00055', 'KEC-0079', 'KAB-060', 'PRO-05', 'Ranah', 28461),
('KEL-00056', 'KEC-0079', 'KAB-060', 'PRO-05', 'Ranah Baru', 28461),
('KEL-00057', 'KEC-0079', 'KAB-060', 'PRO-05', 'Ranah Singkuang', 28461),
('KEL-00058', 'KEC-0079', 'KAB-060', 'PRO-05', 'Rumbio', 28461),
('KEL-00059', 'KEC-0079', 'KAB-060', 'PRO-05', 'Simpang Kubu', 28461),
('KEL-00060', 'KEC-0079', 'KAB-060', 'PRO-05', 'Tanjung Berulak', 28461),
('KEL-00061', 'KEC-0079', 'KAB-060', 'PRO-05', 'Tanjung Rambutan', 28461),
('KEL-00062', 'KEC-0078', 'KAB-060', 'PRO-05', 'Domo', 28471),
('KEL-00063', 'KEC-0078', 'KAB-060', 'PRO-05', 'IV Koto Setingkai', 28471),
('KEL-00064', 'KEC-0078', 'KAB-060', 'PRO-05', 'Kuntu', 28471),
('KEL-00065', 'KEC-0078', 'KAB-060', 'PRO-05', 'Kuntu Darussalam', 28471),
('KEL-00066', 'KEC-0078', 'KAB-060', 'PRO-05', 'Lipat Kain', 28471),
('KEL-00067', 'KEC-0078', 'KAB-060', 'PRO-05', 'Lipat Kain Selatan', 28471),
('KEL-00068', 'KEC-0078', 'KAB-060', 'PRO-05', 'Lipat Kain Utara', 28471),
('KEL-00069', 'KEC-0078', 'KAB-060', 'PRO-05', 'Muara Selaya', 28471),
('KEL-00070', 'KEC-0078', 'KAB-060', 'PRO-05', 'Padang Sawah', 28471),
('KEL-00071', 'KEC-0078', 'KAB-060', 'PRO-05', 'Sungau Geringging', 28471),
('KEL-00072', 'KEC-0078', 'KAB-060', 'PRO-05', 'Sungai Harapan', 28471),
('KEL-00073', 'KEC-0078', 'KAB-060', 'PRO-05', 'Sungai Liti', 28471),
('KEL-00074', 'KEC-0078', 'KAB-060', 'PRO-05', 'Sungai Paku', 28471),
('KEL-00075', 'KEC-0078', 'KAB-060', 'PRO-05', 'Sungai Raja', 28471),
('KEL-00076', 'KEC-0078', 'KAB-060', 'PRO-05', 'Sungai Rambai', 28471),
('KEL-00077', 'KEC-0078', 'KAB-060', 'PRO-05', 'Sungai Sarik', 28471),
('KEL-00078', 'KEC-0078', 'KAB-060', 'PRO-05', 'Tanjung Harapan', 28471),
('KEL-00079', 'KEC-0078', 'KAB-060', 'PRO-05', 'Tanjung Mas', 28471),
('KEL-00080', 'KEC-0078', 'KAB-060', 'PRO-05', 'Teluk Paman', 28471),
('KEL-00081', 'KEC-0078', 'KAB-060', 'PRO-05', 'Teluk Paman Timur', 28471),
('KEL-00082', 'KEC-0077', 'KAB-060', 'PRO-05', 'Bangun Sari', 28471),
('KEL-00083', 'KEC-0077', 'KAB-060', 'PRO-05', 'Gading Permai', 28471),
('KEL-00084', 'KEC-0077', 'KAB-060', 'PRO-05', 'Mentulik', 28471),
('KEL-00085', 'KEC-0077', 'KAB-060', 'PRO-05', 'Rantau Kasih', 28471),
('KEL-00086', 'KEC-0077', 'KAB-060', 'PRO-05', 'Sungai Bungo', 28471),
('KEL-00087', 'KEC-0077', 'KAB-060', 'PRO-05', 'Sungai Pagar', 28471),
('KEL-00088', 'KEC-0077', 'KAB-060', 'PRO-05', 'Sungai Petai', 28471),
('KEL-00089', 'KEC-0077', 'KAB-060', 'PRO-05', 'Sungai Simpang Dua', 28471),
('KEL-00090', 'KEC-0076', 'KAB-060', 'PRO-05', 'Aur Kuning', 28471),
('KEL-00091', 'KEC-0076', 'KAB-060', 'PRO-05', 'Batu Sanggan', 28471),
('KEL-00092', 'KEC-0076', 'KAB-060', 'PRO-05', 'Batu Sasak', 28471),
('KEL-00093', 'KEC-0076', 'KAB-060', 'PRO-05', 'Bukit Betung', 28471),
('KEL-00094', 'KEC-0076', 'KAB-060', 'PRO-05', 'Danau Sontul', 28471),
('KEL-00095', 'KEC-0076', 'KAB-060', 'PRO-05', 'Deras Tajak', 28471),
('KEL-00096', 'KEC-0076', 'KAB-060', 'PRO-05', 'Dua Sepakat', 28471),
('KEL-00097', 'KEC-0076', 'KAB-060', 'PRO-05', 'Gaja Bertalut', 28471),
('KEL-00098', 'KEC-0076', 'KAB-060', 'PRO-05', 'Gema', 28471),
('KEL-00099', 'KEC-0076', 'KAB-060', 'PRO-05', 'Kebun Tinggi', 28471),
('KEL-00100', 'KEC-0076', 'KAB-060', 'PRO-05', 'Kota Lama', 28471),
('KEL-00101', 'KEC-0076', 'KAB-060', 'PRO-05', 'Lubuk Linggau', 28471),
('KEL-00102', 'KEC-0076', 'KAB-060', 'PRO-05', 'Ludai', 28471),
('KEL-00103', 'KEC-0076', 'KAB-060', 'PRO-05', 'Muarobio', 28471),
('KEL-00104', 'KEC-0076', 'KAB-060', 'PRO-05', 'Pangkalan Kapas', 28471),
('KEL-00105', 'KEC-0076', 'KAB-060', 'PRO-05', 'Pangkalan Serai', 28471),
('KEL-00106', 'KEC-0076', 'KAB-060', 'PRO-05', 'Subayang Jaya', 28471),
('KEL-00107', 'KEC-0076', 'KAB-060', 'PRO-05', 'Sungai Santi', 28471),
('KEL-00108', 'KEC-0076', 'KAB-060', 'PRO-05', 'Tanjung Belit', 28471),
('KEL-00109', 'KEC-0076', 'KAB-060', 'PRO-05', 'Tanjung Belit Selatan', 28471),
('KEL-00110', 'KEC-0076', 'KAB-060', 'PRO-05', 'Tanjung Beringin', 28471),
('KEL-00111', 'KEC-0076', 'KAB-060', 'PRO-05', 'Tanjung Karang', 28471),
('KEL-00112', 'KEC-0076', 'KAB-060', 'PRO-05', 'Tanjung Permai', 28471),
('KEL-00113', 'KEC-0075', 'KAB-060', 'PRO-05', 'Bina Baru', 28471),
('KEL-00114', 'KEC-0075', 'KAB-060', 'PRO-05', 'Bukit Sakai', 28471),
('KEL-00115', 'KEC-0075', 'KAB-060', 'PRO-05', 'Hidup Baru', 28471),
('KEL-00116', 'KEC-0075', 'KAB-060', 'PRO-05', 'Karya Bhakti', 28471),
('KEL-00117', 'KEC-0075', 'KAB-060', 'PRO-05', 'Koto Damai', 28471),
('KEL-00118', 'KEC-0075', 'KAB-060', 'PRO-05', 'Lubuk Sakai', 28471),
('KEL-00119', 'KEC-0075', 'KAB-060', 'PRO-05', 'Mayang Pongkai', 28471),
('KEL-00120', 'KEC-0075', 'KAB-060', 'PRO-05', 'Mekar Jaya', 28471),
('KEL-00121', 'KEC-0075', 'KAB-060', 'PRO-05', 'Penghidupan', 28471),
('KEL-00122', 'KEC-0075', 'KAB-060', 'PRO-05', 'Simalinyang', 28471),
('KEL-00123', 'KEC-0075', 'KAB-060', 'PRO-05', 'Utama Karya', 28471),
('KEL-00124', 'KEC-0074', 'KAB-060', 'PRO-05', 'Deli Makmur', 28461),
('KEL-00125', 'KEC-0074', 'KAB-060', 'PRO-05', 'Kampar', 28461),
('KEL-00126', 'KEC-0074', 'KAB-060', 'PRO-05', 'Koto Perambahan', 28461),
('KEL-00127', 'KEC-0074', 'KAB-060', 'PRO-05', 'Pulau Birandang', 28461),
('KEL-00128', 'KEC-0074', 'KAB-060', 'PRO-05', 'Pulau Rambai', 28461),
('KEL-00129', 'KEC-0074', 'KAB-060', 'PRO-05', 'Sawah Baru', 28461),
('KEL-00130', 'KEC-0074', 'KAB-060', 'PRO-05', 'Sungai Putih', 28461),
('KEL-00131', 'KEC-0074', 'KAB-060', 'PRO-05', 'Sungai Tiarap', 28461),
('KEL-00132', 'KEC-0074', 'KAB-060', 'PRO-05', 'Tanjung Bungo', 28461),
('KEL-00133', 'KEC-0073', 'KAB-060', 'PRO-05', 'Kampung Panjang (Air Tiris)', 28461),
('KEL-00134', 'KEC-0073', 'KAB-060', 'PRO-05', 'Kayu Aro', 28461),
('KEL-00135', 'KEC-0073', 'KAB-060', 'PRO-05', 'Muara Jalai', 28461),
('KEL-00136', 'KEC-0073', 'KAB-060', 'PRO-05', 'Naga Beralih', 28461),
('KEL-00137', 'KEC-0073', 'KAB-060', 'PRO-05', 'Sawah', 28461),
('KEL-00138', 'KEC-0073', 'KAB-060', 'PRO-05', 'Sei/Sungai Jalau', 28461),
('KEL-00139', 'KEC-0073', 'KAB-060', 'PRO-05', 'Sei/Sungai Tonang', 28461),
('KEL-00140', 'KEC-0073', 'KAB-060', 'PRO-05', 'Sendayan', 28461),
('KEL-00141', 'KEC-0072', 'KAB-060', 'PRO-05', 'Bandur Picak', 28461),
('KEL-00142', 'KEC-0072', 'KAB-060', 'PRO-05', 'Gunung Malelo', 28461),
('KEL-00143', 'KEC-0072', 'KAB-060', 'PRO-05', 'Pongkai', 28461),
('KEL-00144', 'KEC-0072', 'KAB-060', 'PRO-05', 'Siberuang', 28461),
('KEL-00145', 'KEC-0072', 'KAB-060', 'PRO-05', 'Tabing', 28461),
('KEL-00146', 'KEC-0072', 'KAB-060', 'PRO-05', 'Tanjung', 28461),
('KEL-00147', 'KEC-0071', 'KAB-060', 'PRO-05', 'Batulangka Kecil', 28463),
('KEL-00148', 'KEC-0071', 'KAB-060', 'PRO-05', 'Bukit Melintang', 28463),
('KEL-00149', 'KEC-0071', 'KAB-060', 'PRO-05', 'Empat Balai', 28463),
('KEL-00150', 'KEC-0071', 'KAB-060', 'PRO-05', 'Kuok', 28463),
('KEL-00151', 'KEC-0071', 'KAB-060', 'PRO-05', 'Lereng', 28463),
('KEL-00152', 'KEC-0071', 'KAB-060', 'PRO-05', 'Merangin', 28463),
('KEL-00153', 'KEC-0071', 'KAB-060', 'PRO-05', 'Pulau Jambu', 28463),
('KEL-00154', 'KEC-0071', 'KAB-060', 'PRO-05', 'Pulautarap', 28463),
('KEL-00155', 'KEC-0071', 'KAB-060', 'PRO-05', 'Silam', 28463),
('KEL-00156', 'KEC-0070', 'KAB-060', 'PRO-05', 'Hangtuah', 28462),
('KEL-00157', 'KEC-0070', 'KAB-060', 'PRO-05', 'Kampung Pinang', 28462),
('KEL-00158', 'KEC-0070', 'KAB-060', 'PRO-05', 'Lubuk Sakat', 28462),
('KEL-00159', 'KEC-0070', 'KAB-060', 'PRO-05', 'Pantai Raja', 28462),
('KEL-00160', 'KEC-0070', 'KAB-060', 'PRO-05', 'Sialang Kubang', 28462),
('KEL-00161', 'KEC-0069', 'KAB-060', 'PRO-05', 'Alam Panjang', 28458),
('KEL-00162', 'KEC-0069', 'KAB-060', 'PRO-05', 'Batang Batindih', 28458),
('KEL-00163', 'KEC-0069', 'KAB-060', 'PRO-05', 'Bukit Kratai', 28458),
('KEL-00164', 'KEC-0069', 'KAB-060', 'PRO-05', 'Pulau Payung', 28458),
('KEL-00165', 'KEC-0069', 'KAB-060', 'PRO-05', 'Simpang Petai', 28458),
('KEL-00166', 'KEC-0069', 'KAB-060', 'PRO-05', 'Tambusai', 28458),
('KEL-00167', 'KEC-0069', 'KAB-060', 'PRO-05', 'Teratak', 28458),
('KEL-00168', 'KEC-0068', 'KAB-060', 'PRO-05', 'Ganting', 28451),
('KEL-00169', 'KEC-0068', 'KAB-060', 'PRO-05', 'Ganting Damai', 28451),
('KEL-00170', 'KEC-0068', 'KAB-060', 'PRO-05', 'Salo', 28451),
('KEL-00171', 'KEC-0068', 'KAB-060', 'PRO-05', 'Salo Timur', 28451),
('KEL-00172', 'KEC-0068', 'KAB-060', 'PRO-05', 'Siabu', 28451),
('KEL-00173', 'KEC-0068', 'KAB-060', 'PRO-05', 'Sipungguk', 28451),
('KEL-00174', 'KEC-0067', 'KAB-060', 'PRO-05', 'Buluh Cina', 28452),
('KEL-00175', 'KEC-0067', 'KAB-060', 'PRO-05', 'Buluh Nipis', 28452),
('KEL-00176', 'KEC-0067', 'KAB-060', 'PRO-05', 'Desa Baru', 28452),
('KEL-00177', 'KEC-0067', 'KAB-060', 'PRO-05', 'Kepau Jaya', 28452),
('KEL-00178', 'KEC-0067', 'KAB-060', 'PRO-05', 'Kubang Jaya', 28452),
('KEL-00179', 'KEC-0067', 'KAB-060', 'PRO-05', 'Lubuk Siam', 28452),
('KEL-00180', 'KEC-0067', 'KAB-060', 'PRO-05', 'Pandau Jaya', 28452),
('KEL-00181', 'KEC-0067', 'KAB-060', 'PRO-05', 'Kubang Jaya', 28452),
('KEL-00182', 'KEC-0067', 'KAB-060', 'PRO-05', 'Lubuk Siam', 28452),
('KEL-00183', 'KEC-0067', 'KAB-060', 'PRO-05', 'Pandau Jaya', 28452),
('KEL-00184', 'KEC-0067', 'KAB-060', 'PRO-05', 'Pangkalan Baru', 28452),
('KEL-00185', 'KEC-0067', 'KAB-060', 'PRO-05', 'Pangkalan Serik', 28452),
('KEL-00186', 'KEC-0067', 'KAB-060', 'PRO-05', 'Tanah Merah', 28452),
('KEL-00187', 'KEC-0067', 'KAB-060', 'PRO-05', 'Tanjung Balai', 28452),
('KEL-00188', 'KEC-0066', 'KAB-060', 'PRO-05', 'Aursati', 28462),
('KEL-00189', 'KEC-0066', 'KAB-060', 'PRO-05', 'Balam Jaya', 28462),
('KEL-00190', 'KEC-0066', 'KAB-060', 'PRO-05', 'Gobah', 28462),
('KEL-00191', 'KEC-0066', 'KAB-060', 'PRO-05', 'Kemang Indah', 28462),
('KEL-00192', 'KEC-0066', 'KAB-060', 'PRO-05', 'Kualu', 28462),
('KEL-00193', 'KEC-0066', 'KAB-060', 'PRO-05', 'Kualu Nenas', 28462),
('KEL-00194', 'KEC-0066', 'KAB-060', 'PRO-05', 'Kuapan', 28462),
('KEL-00195', 'KEC-0066', 'KAB-060', 'PRO-05', 'Padang Luas', 28462),
('KEL-00196', 'KEC-0066', 'KAB-060', 'PRO-05', 'Palung Raya', 28462),
('KEL-00197', 'KEC-0066', 'KAB-060', 'PRO-05', 'Parit Baru', 28462),
('KEL-00198', 'KEC-0066', 'KAB-060', 'PRO-05', 'Pulau Permai', 28462),
('KEL-00199', 'KEC-0066', 'KAB-060', 'PRO-05', 'Rimbo Panjang', 28462),
('KEL-00200', 'KEC-0066', 'KAB-060', 'PRO-05', 'Sei/Sungai Pinang', 28462),
('KEL-00201', 'KEC-0066', 'KAB-060', 'PRO-05', 'Tambang', 28462),
('KEL-00202', 'KEC-0066', 'KAB-060', 'PRO-05', 'Tarai Bangun', 28462),
('KEL-00203', 'KEC-0066', 'KAB-060', 'PRO-05', 'Teluk Kenidai', 28462),
('KEL-00204', 'KEC-0066', 'KAB-060', 'PRO-05', 'Terantang', 28462),
('KEL-00205', 'KEC-0065', 'KAB-060', 'PRO-05', 'Air Terbit', 28464),
('KEL-00206', 'KEC-0065', 'KAB-060', 'PRO-05', 'Batu Gajah', 28464),
('KEL-00207', 'KEC-0065', 'KAB-060', 'PRO-05', 'Bencah Kelubi', 28464),
('KEL-00208', 'KEC-0065', 'KAB-060', 'PRO-05', 'Gading Sari', 28464),
('KEL-00209', 'KEC-0065', 'KAB-060', 'PRO-05', 'Indra Sakti', 28464),
('KEL-00210', 'KEC-0065', 'KAB-060', 'PRO-05', 'Indrapuri', 28464),
('KEL-00211', 'KEC-0065', 'KAB-060', 'PRO-05', 'Karya Indah', 28464),
('KEL-00212', 'KEC-0065', 'KAB-060', 'PRO-05', 'Kijang Rejo', 28464),
('KEL-00213', 'KEC-0065', 'KAB-060', 'PRO-05', 'Kenantan', 28464),
('KEL-00214', 'KEC-0065', 'KAB-060', 'PRO-05', 'Muara Mahat Baru', 28464),
('KEL-00215', 'KEC-0065', 'KAB-060', 'PRO-05', 'Mukti Sari', 28464),
('KEL-00216', 'KEC-0065', 'KAB-060', 'PRO-05', 'Pagaruyung', 28464),
('KEL-00217', 'KEC-0065', 'KAB-060', 'PRO-05', 'Pancuran Gading', 28464),
('KEL-00218', 'KEC-0065', 'KAB-060', 'PRO-05', 'Pantai Cermin', 28464),
('KEL-00219', 'KEC-0065', 'KAB-060', 'PRO-05', 'Pelambaian', 28464),
('KEL-00220', 'KEC-0065', 'KAB-060', 'PRO-05', 'Petapahan', 28464),
('KEL-00221', 'KEC-0065', 'KAB-060', 'PRO-05', 'Petapahan Jaya', 28464),
('KEL-00222', 'KEC-0065', 'KAB-060', 'PRO-05', 'Sari Galuh', 28464),
('KEL-00223', 'KEC-0065', 'KAB-060', 'PRO-05', 'Sei/Sungai Agung', 28464),
('KEL-00224', 'KEC-0065', 'KAB-060', 'PRO-05', 'Sei/Sungai Lembu Makmur', 28464),
('KEL-00225', 'KEC-0065', 'KAB-060', 'PRO-05', 'Tanjung Sawit', 28464),
('KEL-00226', 'KEC-0065', 'KAB-060', 'PRO-05', 'Tri Manunggal', 28464),
('KEL-00227', 'KEC-0064', 'KAB-060', 'PRO-05', 'Beringin Lestari', 28464),
('KEL-00228', 'KEC-0064', 'KAB-060', 'PRO-05', 'Cinta Damai', 28464),
('KEL-00229', 'KEC-0064', 'KAB-060', 'PRO-05', 'Gerbang Sari', 28464),
('KEL-00230', 'KEC-0064', 'KAB-060', 'PRO-05', 'Kijang Jaya', 28464),
('KEL-00231', 'KEC-0064', 'KAB-060', 'PRO-05', 'Kijang Makmur', 28464),
('KEL-00232', 'KEC-0064', 'KAB-060', 'PRO-05', 'Koto Baru', 28464),
('KEL-00233', 'KEC-0064', 'KAB-060', 'PRO-05', 'Kota Garo', 28464),
('KEL-00234', 'KEC-0064', 'KAB-060', 'PRO-05', 'Koto Bangun', 28464),
('KEL-00235', 'KEC-0064', 'KAB-060', 'PRO-05', 'Koto Aman', 28464),
('KEL-00236', 'KEC-0064', 'KAB-060', 'PRO-05', 'Sikijang', 28464),
('KEL-00237', 'KEC-0064', 'KAB-060', 'PRO-05', 'Suka Maju', 28464),
('KEL-00238', 'KEC-0064', 'KAB-060', 'PRO-05', 'Tanah Tinggi', 28464),
('KEL-00239', 'KEC-0064', 'KAB-060', 'PRO-05', 'Tandan Sari', 28464),
('KEL-00240', 'KEC-0064', 'KAB-060', 'PRO-05', 'Tapung Lestari', 28464),
('KEL-00241', 'KEC-0064', 'KAB-060', 'PRO-05', 'Tapung Makmur', 28464),
('KEL-00242', 'KEC-0064', 'KAB-060', 'PRO-05', 'Tebing Lestari', 28464),
('KEL-00243', 'KEC-0063', 'KAB-060', 'PRO-05', 'Bukit Kemunging', 28464),
('KEL-00244', 'KEC-0063', 'KAB-060', 'PRO-05', 'Danau Lancang', 28464),
('KEL-00245', 'KEC-0063', 'KAB-060', 'PRO-05', 'Kasikan', 28464),
('KEL-00246', 'KEC-0063', 'KAB-060', 'PRO-05', 'Kusau Makmur', 28464),
('KEL-00247', 'KEC-0063', 'KAB-060', 'PRO-05', 'Rimba Beringin', 28464),
('KEL-00248', 'KEC-0063', 'KAB-060', 'PRO-05', 'Sinama Nenek', 28464),
('KEL-00249', 'KEC-0063', 'KAB-060', 'PRO-05', 'Sukaramai', 28464),
('KEL-00250', 'KEC-0063', 'KAB-060', 'PRO-05', 'Sumber Sari', 28464),
('KEL-00251', 'KEC-0063', 'KAB-060', 'PRO-05', 'Talang Danto', 28464),
('KEL-00252', 'KEC-0062', 'KAB-060', 'PRO-05', 'Balung', 28453),
('KEL-00253', 'KEC-0062', 'KAB-060', 'PRO-05', 'Batu Bersurat', 28453),
('KEL-00254', 'KEC-0062', 'KAB-060', 'PRO-05', 'Binamang', 28453),
('KEL-00255', 'KEC-0062', 'KAB-060', 'PRO-05', 'Gunung Bungsu', 28453),
('KEL-00256', 'KEC-0062', 'KAB-060', 'PRO-05', 'Koto Mesjid', 28453),
('KEL-00257', 'KEC-0062', 'KAB-060', 'PRO-05', 'Koto Tuo', 28453),
('KEL-00258', 'KEC-0062', 'KAB-060', 'PRO-05', 'Koto Tuo Barat', 28453),
('KEL-00259', 'KEC-0062', 'KAB-060', 'PRO-05', 'Lubuk Agung', 28453),
('KEL-00260', 'KEC-0062', 'KAB-060', 'PRO-05', 'Muara Takus', 28453),
('KEL-00261', 'KEC-0062', 'KAB-060', 'PRO-05', 'Pongkai Istiqomah', 28453),
('KEL-00262', 'KEC-0062', 'KAB-060', 'PRO-05', 'Pulau Gadang', 28453),
('KEL-00263', 'KEC-0062', 'KAB-060', 'PRO-05', 'Ranah Sungkai', 28453),
('KEL-00264', 'KEC-0062', 'KAB-060', 'PRO-05', 'Tanjung Alai', 28453),
('KEL-00265', 'KEC-0043', 'KAB-068', 'PRO-05', 'Rejosari', 28281),
('KEL-00266', 'KEC-0043', 'KAB-068', 'PRO-05', 'Sail', 28285),
('KEL-00267', 'KEC-0043', 'KAB-068', 'PRO-05', 'Tangkerang Timur', 28289),
('KEL-00268', 'KEC-0042', 'KAB-068', 'PRO-05', 'Delima', 28291),
('KEL-00269', 'KEC-0042', 'KAB-068', 'PRO-05', 'Sidomulyo Barat', 28294),
('KEL-00270', 'KEC-0042', 'KAB-068', 'PRO-05', 'Simpang Baru', 28293),
('KEL-00271', 'KEC-0042', 'KAB-068', 'PRO-05', 'Tuah Karya', 28291),
('KEL-00272', 'KEC-0041', 'KAB-068', 'PRO-05', 'Harjosari', 28122),
('KEL-00273', 'KEC-0041', 'KAB-068', 'PRO-05', 'Jadirejo', 28126),
('KEL-00274', 'KEC-0041', 'KAB-068', 'PRO-05', 'Kampung Melayu', 28124),
('KEL-00275', 'KEC-0041', 'KAB-068', 'PRO-05', 'Kampung Tengah', 28128),
('KEL-00276', 'KEC-0041', 'KAB-068', 'PRO-05', 'Kedung Sari', 28123),
('KEL-00277', 'KEC-0041', 'KAB-068', 'PRO-05', 'Pulau Karam', 28127),
('KEL-00278', 'KEC-0041', 'KAB-068', 'PRO-05', 'Sukajadi', 28121),
('KEL-00279', 'KEC-0040', 'KAB-068', 'PRO-05', 'Kampung Bandar', 28153),
('KEL-00280', 'KEC-0040', 'KAB-068', 'PRO-05', 'Kampung Baru', 28154),
('KEL-00281', 'KEC-0040', 'KAB-068', 'PRO-05', 'Kampung Dalam', 28152),
('KEL-00282', 'KEC-0040', 'KAB-068', 'PRO-05', 'Padang Bulan', 28156),
('KEL-00283', 'KEC-0040', 'KAB-068', 'PRO-05', 'Padang Terubuk', 28155),
('KEL-00284', 'KEC-0040', 'KAB-068', 'PRO-05', 'Sago', 28151),
('KEL-00285', 'KEC-0039', 'KAB-068', 'PRO-05', 'Cinta Raja', 28131),
('KEL-00286', 'KEC-0039', 'KAB-068', 'PRO-05', 'Suka Maju', 28131),
('KEL-00287', 'KEC-0039', 'KAB-068', 'PRO-05', 'Suka Mulya', 28131),
('KEL-00288', 'KEC-0038', 'KAB-068', 'PRO-05', 'Lembah Damai', 28263),
('KEL-00289', 'KEC-0038', 'KAB-068', 'PRO-05', 'Lembah Sari', 28262),
('KEL-00290', 'KEC-0038', 'KAB-068', 'PRO-05', 'Limbungan', 28261),
('KEL-00291', 'KEC-0038', 'KAB-068', 'PRO-05', 'Limbungan Baru', 28261),
('KEL-00292', 'KEC-0038', 'KAB-068', 'PRO-05', 'Meranti Pandak', 28266),
('KEL-00293', 'KEC-0037', 'KAB-068', 'PRO-05', 'Muara Fajar', 28267),
('KEL-00294', 'KEC-0037', 'KAB-068', 'PRO-05', 'Palas', 28264),
('KEL-00295', 'KEC-0037', 'KAB-068', 'PRO-05', 'Rumbai Bukit/Kampung Bukit', 28264),
('KEL-00296', 'KEC-0037', 'KAB-068', 'PRO-05', 'Sri Meranti', 28261),
('KEL-00297', 'KEC-0037', 'KAB-068', 'PRO-05', 'Umban Sari', 28265),
('KEL-00298', 'KEC-0036', 'KAB-068', 'PRO-05', 'Kota Baru', 28114),
('KEL-00299', 'KEC-0036', 'KAB-068', 'PRO-05', 'Kota Tinggi', 28116),
('KEL-00300', 'KEC-0036', 'KAB-068', 'PRO-05', 'Simpang Empat', 28116),
('KEL-00301', 'KEC-0036', 'KAB-068', 'PRO-05', 'Suka Ramai', 28111),
('KEL-00302', 'KEC-0036', 'KAB-068', 'PRO-05', 'Suma Hilang', 28111),
('KEL-00303', 'KEC-0036', 'KAB-068', 'PRO-05', 'Tanah Datar', 28115),
('KEL-00304', 'KEC-0035', 'KAB-068', 'PRO-05', 'Air Hitam', 28292),
('KEL-00305', 'KEC-0035', 'KAB-068', 'PRO-05', 'Labuh Baru Barat', 28292),
('KEL-00306', 'KEC-0035', 'KAB-068', 'PRO-05', 'Labuh Baru Timur', 28292),
('KEL-00307', 'KEC-0035', 'KAB-068', 'PRO-05', 'Tampan', 28292);

CREATE TABLE IF NOT EXISTS `mahasiswa` (
`id` int(11) NOT NULL,
  `kode_mahasiswa` varchar(15) NOT NULL,
  `nama_mahasiswa` varchar(250) NOT NULL,
  `alamat` varchar(255) NOT NULL,
  `provinsi` varchar(100) NOT NULL,
  `kabupaten` varchar(100) NOT NULL,
  `kecamatan` varchar(100) NOT NULL,
  `kelurahan` varchar(100) NOT NULL
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

INSERT INTO `mahasiswa` (`id`, `kode_mahasiswa`, `nama_mahasiswa`, `alamat`, `provinsi`, `kabupaten`, `kecamatan`, `kelurahan`) VALUES
(2, 'MHS-2015-0001', 'jepretcode 1', 'Jl. Sudirman No. 1', 'PRO-05', 'KAB-068', 'KEC-0032', 'KEL-00003');
  1. Aktifkan localhost atau webserver
  2. Download codeigniter, saya menggunakan ver. 2.2.0
  3. Buat folder dengan nama dropdown_provinsi_kelurahan Extract codeigniter didalam  didalam folder ini
  4. Buatlah sebuah file controller didalam application\controllers\ dengan nama c_mahasiswa.php dan copy kode dibawah ini kedalam file c_mahasiswa.php  
    <?php
    
    class C_mahasiswa extends CI_Controller{
     
     public function __construct(){
      parent::__construct();  
      $this->load->model('m_mahasiswa');
     }
     
     public function index(){ 
      redirect('c_mahasiswa/tambah_mahasiswa');
     } 
      
     public function tambah_mahasiswa(){
      if($this->uri->segment(3)==""){
       $offset=0;
      }else{
       $offset=$this->uri->segment(3);
      }
      $limit = 5;   
      $data['list']=$this->m_mahasiswa->getProvinsi();
      $data['mahasiswa'] = $this->m_mahasiswa->getAllMahasiswa($offset, $limit);
      $data['count'] = $this->m_mahasiswa->getAllMahasiswa_count(); 
      $config = array();
      $config['base_url'] = base_url(). 'c_mahasiswa/tambah_mahasiswa/';
      $config['per_page'] = $limit;
      $config['uri_segment'] = 3;
      $config['num_links'] = 5;  
      $config['first_tag_open'] = '<li>';
      $config['first_link'] = 'First';
      $config['first_tag_close'] = '</li>';
      $config['prev_link'] = 'Prev';
      $config['prev_tag_open'] = '<li>';
      $config['prev_tag_close'] = '</li>';
      $config['cur_tag_open'] = '<li class="active"><a href>';
      $config['cur_tag_close'] = '</a></li>';
      $config['next_link'] = 'Next';
      $config['next_tag_open'] = '<li>';
      $config['next_tag_close'] = '</li>';
      $config['num_tag_open'] = '<li>';
      $config['num_tag_close'] = '</li>';
      $config['last_tag_open'] = '<li>';
      $config['last_link'] = 'Last';
      $config['last_tag_close'] = '</li>';
      $config['total_rows'] = $data['count'];
      $this->pagination->initialize($config);
      $this->session->set_userdata('row', $this->uri->segment(3));
      $data['kode_mahasiswa'] = $this->m_mahasiswa->get_kode_mahasiswa();
      $data['error'] = "";    
      $this->load->model('m_mahasiswa');  
      $this->load->view('admin/mahasiswa/tambah_mahasiswa', $data);  
     }  
     
     public function loadData(){
      $loadType=$this->input->post('loadType');
      $loadId=$this->input->post('loadId');
      $this->load->model('m_mahasiswa');
      $data=$this->m_mahasiswa->getData($loadType,$loadId);
      $HTML="";  
      if($data->num_rows() > 0){
       foreach($data->result() as $list){
        $HTML.="<option value='".$list->id."'>".$list->name."</option>";
       }
      }
      echo $HTML;
     }
     
     public function submit_tambah_mahasiswa(){ 
      $this->form_validation->set_rules('nama_mahasiswa','Nama Mahasiswa', 'required|xss_clean|max_length[255]|trim|strip_tags');
      $this->form_validation->set_rules('alamat','Alamat', 'required|xss_clean|max_length[255]|trim|strip_tags');
      $this->form_validation->set_rules('provinsi','Provinsi', 'required');
      $this->form_validation->set_rules('kabupaten','Kabupaten', 'required');
      $this->form_validation->set_rules('kecamatan','Kecamatan', 'required');
      $this->form_validation->set_rules('kelurahan','Kecamatan', 'required');
      
    
      if($this->form_validation->run() == TRUE){ 
       
      $input_kode_mahasiswa = $this->input->post('kode_mahasiswa');   
      $input_nama_mahasiswa= $this->input->post('nama_mahasiswa');
       $input_alamat = $this->input->post('alamat');
       $input_provinsi = $this->input->post('provinsi');
       $input_kabupaten = $this->input->post('kabupaten');
       $input_kecamatan = $this->input->post('kecamatan');
       $input_kelurahan = $this->input->post('kelurahan');
       
       $ganti = array("'");
       $oleh = "&#039;";   
       $kode_mahasiswa = str_replace($ganti, $oleh, $input_kode_mahasiswa);
       $nama_mahasiswa = str_replace($ganti, $oleh, $input_nama_mahasiswa);
       $alamat = str_replace($ganti, $oleh, $input_alamat);
       $provinsi = str_replace($ganti, $oleh, $input_provinsi);
       $kabupaten = str_replace($ganti, $oleh, $input_kabupaten);
       $kecamatan = str_replace($ganti, $oleh, $input_kecamatan);
       $kelurahan = str_replace($ganti, $oleh, $input_kelurahan);
       $this->m_mahasiswa->inputMahasiswa($kode_mahasiswa, $nama_mahasiswa, $alamat, $provinsi, $kabupaten, $kecamatan, $kelurahan);
     
       $data['list']=$this->m_mahasiswa->getProvinsi();
       redirect('c_mahasiswa/tambah_mahasiswa');
       }else{ 
       $data['error'] = "";
       }
     if($this->uri->segment(3)==""){
      $offset=0;
     }else{
      $offset=$this->uri->segment(3);
     }
     $limit = 5;   
     $data['list']=$this->m_mahasiswa->getProvinsi();
     $data['mahasiswa'] = $this->m_mahasiswa->getAllMahasiswa($offset, $limit);
     $data['count'] = $this->m_mahasiswa->getAllMahasiswa_count(); 
     $config = array();
     $config['base_url'] = base_url(). 'c_mahasiswa/tambah_mahasiswa/';
     $config['per_page'] = $limit;
     $config['uri_segment'] = 3;
     $config['num_links'] = 5;  
     $config['first_tag_open'] = '<li>';
     $config['first_link'] = 'First';
     $config['first_tag_close'] = '</li>';
     $config['prev_link'] = 'Prev';
     $config['prev_tag_open'] = '<li>';
     $config['prev_tag_close'] = '</li>';
     $config['cur_tag_open'] = '<li class="active"><a href>';
     $config['cur_tag_close'] = '</a></li>';
     $config['next_link'] = 'Next';
     $config['next_tag_open'] = '<li>';
     $config['next_tag_close'] = '</li>';
     $config['num_tag_open'] = '<li>';
     $config['num_tag_close'] = '</li>';
     $config['last_tag_open'] = '<li>';
     $config['last_link'] = 'Last';
     $config['last_tag_close'] = '</li>';
     $config['total_rows'] = $data['count'];
     $this->pagination->initialize($config);
     $this->session->set_userdata('row', $this->uri->segment(3));
     $data['kode_mahasiswa'] = $this->m_mahasiswa->get_kode_mahasiswa();
     $data['error'] = "";    
     $this->load->model('m_mahasiswa');  
     $this->load->view('admin/mahasiswa/tambah_mahasiswa', $data);  
     }
     
     public function hapus_mahasiswa($kode_mahasiswa){
      $query = $this->m_mahasiswa->getEditMahasiswa($kode_mahasiswa)->row();      
      $this->m_mahasiswa->hapus_mahasiswa($kode_mahasiswa);
      redirect('c_mahasiswa/tambah_mahasiswa');
     }
    }
    
  5. Buatlah sebuah model dengan nama m_mahasiswa.php didalam folder application\models dan kode dibawah ini sebagai isinya. 
    <?php 
    
    class M_mahasiswa extends CI_Model{
     
     public function __construct(){
      parent::__construct();
     }
     
     public function get_kode_mahasiswa() {
      $tahun = date("Y");
      $kode = 'MHS';
      $query = $this->db->query("SELECT MAX(kode_mahasiswa) as max_id FROM mahasiswa"); 
      $row = $query->row_array();
      $max_id = $row['max_id']; 
      $max_id1 =(int) substr($max_id,9,5);
      $kode_mahasiswa = $max_id1 +1;
      $maxkode_mahasiswa = $kode.'-'.$tahun.'-'.sprintf("%04s",$kode_mahasiswa);
      return $maxkode_mahasiswa;
     }
     
     public function getData($loadType,$loadId){
      if($loadType=="kabupaten"){
       //id_kab diubah sebagasi (as id) karena typenya $loadID
       $fieldList='id_kab as id,nama_kabupaten as name';
       $table='kabupaten';
       $fieldName='id_prov';
       $orderByField='nama_kabupaten';      
      }else if($loadType=="kecamatan"){
       //id_kecamatan diubah sebagasi (as id) karena typenya $loadID
       $fieldList='id_kecamatan as id,nama_kecamatan as name';
       $table='kecamatan';
       $fieldName='id_kab';
       $orderByField='nama_kecamatan';   
      }else if($loadType=="kelurahan"){
       //id_kelurahan diubah sebagasi (as id) karena typenya $loadID
       $fieldList='id_kelurahan as id,nama_kelurahan as name';
       $table='kelurahan';
       $fieldName='id_kecamatan';
       $orderByField='nama_kelurahan';
      }  
      $this->db->select($fieldList);
      $this->db->from($table);
      $this->db->where($fieldName, $loadId);
      $this->db->order_by($orderByField, 'asc');
      $query=$this->db->get();
      return $query; 
     }
     
     public function getProvinsi(){
      $this->db->select('id_provinsi as id,nama_provinsi');
      $this->db->from('provinsi');
      $this->db->order_by('id', 'asc'); 
      $query=$this->db->get();
      return $query; 
     }
     
     public function getAllMahasiswa($offset, $limit){
      $query = $this->db->query("SELECT 
         p.*,     
         kp.id_provinsi,
         kp.nama_provinsi,     
         kab.id_kab,
         kab.nama_kabupaten,     
         kec.id_kecamatan,
         kec.nama_kecamatan,     
         kel.id_kelurahan,
         kel.nama_kelurahan     
         FROM mahasiswa as p, provinsi as kp, kabupaten as kab, kecamatan as kec, kelurahan as kel 
         WHERE p.provinsi = kp.id_provinsi AND p.kabupaten = kab.id_kab AND p.kecamatan = kec.id_kecamatan AND p.kelurahan = kel.id_kelurahan
         ORDER BY p.kode_mahasiswa DESC LIMIT $offset, $limit");
      return $query;
     }
     
     public function getAllMahasiswa_count(){
      $query = $this->db->query("
       SELECT * FROM mahasiswa
      ");
      return $query->num_rows();
     }
     
     public function inputMahasiswa($kode_mahasiswa, $nama_mahasiswa, $alamat, $provinsi, $kabupaten, $kecamatan, $kelurahan){
      $query = $this->db->query("INSERT INTO mahasiswa VALUES('', '$kode_mahasiswa', '$nama_mahasiswa', '$alamat', '$provinsi', '$kabupaten', '$kecamatan', '$kelurahan')");
     }
     
     public function hapus_mahasiswa($id){
      $this->db->query("DELETE FROM mahasiswa WHERE kode_mahasiswa = '$id' ");
     }
    }
    
  6. Untuk tampilan atau views isi dengan kode dibawah ini dengan nama file tambah_mahasiswa.php didalam folder application\views\admin\mahasiswa 
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <style>
    body {
      margin: 0;
      font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
      font-size: 13px;
      line-height: 18px;
      color: #333333;
      background-color: #ffffff;
    }
    
    a {
      color: #0088cc;
      text-decoration: none;
    }
    
    .row {
      margin-left: -20px;
      *zoom: 1;
    }
    
    .container,
    .navbar-fixed-top .container,
    .navbar-fixed-bottom .container {
      width: 940px;
    }
    
    .span2 {
      width: 140px;
    }
    
    .container {
      margin-right: auto;
      margin-left: auto;
      *zoom: 1;
    }
    
    input,
    select,
    .uneditable-input {
      display: inline-block;
      width: 210px;
      height: 18px;
      padding: 4px;
      margin-bottom: 9px;
      font-size: 13px;
      line-height: 18px;
      color: #555555;
      background-color: #ffffff;
      border: 1px solid #cccccc;
      -webkit-border-radius: 3px;
         -moz-border-radius: 3px;
              border-radius: 3px;
    }
    
    select,
    input[type="file"] {
      height: 28px;
      line-height: 28px;
    }
    
    select {
      width: 220px;
      background-color: #ffffff;
    }
    
    input[readonly] {
      cursor: not-allowed;
      background-color: #eeeeee;
      border-color: #ddd;
    }
    
    .control-group.warning > label,
    .control-group.warning .help-inline {
      color: #c09853;
    }
    
    .control-group.warning input,
    .control-group.warning select {
      color: #c09853;
      border-color: #c09853;
    }
    
    .control-group.warning input:focus,
    .control-group.warning select:focus {
      border-color: #a47e3c;
      -webkit-box-shadow: 0 0 6px #dbc59e;
         -moz-box-shadow: 0 0 6px #dbc59e;
              box-shadow: 0 0 6px #dbc59e;
    }
    
    .control-group.warning .input-prepend .add-on,
    .control-group.warning .input-append .add-on {
      color: #c09853;
      background-color: #fcf8e3;
      border-color: #c09853;
    }
    
    .control-group.error > label,
    .control-group.error .help-inline {
      color: #b94a48;
    }
    
    .control-group.error input {
      color: #b94a48;
      border-color: #b94a48;
    }
    
    .control-group.error input:focus {
      border-color: #953b39;
      -webkit-box-shadow: 0 0 6px #d59392;
         -moz-box-shadow: 0 0 6px #d59392;
              box-shadow: 0 0 6px #d59392;
    }
    
    .control-group.error .input-prepend .add-on,
    .control-group.error .input-append .add-on {
      color: #b94a48;
      background-color: #f2dede;
      border-color: #b94a48;
    }
    
    .control-group.success > label,
    .control-group.success .help-block,
    .control-group.success .help-inline {
      color: #468847;
    }
    
    .control-group.success input,
    .control-group.success select,
    .control-group.success textarea {
      color: #468847;
      border-color: #468847;
    }
    
    .control-group.success input:focus,
    .control-group.success select:focus,
    .control-group.success textarea:focus {
      border-color: #356635;
      -webkit-box-shadow: 0 0 6px #7aba7b;
         -moz-box-shadow: 0 0 6px #7aba7b;
              box-shadow: 0 0 6px #7aba7b;
    }
    
    .control-group.success .input-prepend .add-on,
    .control-group.success .input-append .add-on {
      color: #468847;
      background-color: #dff0d8;
      border-color: #468847;
    }
    
    input:focus:required:invalid,
    textarea:focus:required:invalid,
    select:focus:required:invalid {
      color: #b94a48;
      border-color: #ee5f5b;
    }
    
    input:focus:required:invalid:focus,
    textarea:focus:required:invalid:focus,
    select:focus:required:invalid:focus {
      border-color: #e9322d;
      -webkit-box-shadow: 0 0 6px #f8b9b7;
         -moz-box-shadow: 0 0 6px #f8b9b7;
              box-shadow: 0 0 6px #f8b9b7;
    }
    
    .form-actions {
      padding: 17px 20px 18px;
      margin-top: 18px;
      margin-bottom: 18px;
      background-color: #f5f5f5;
      border-top: 1px solid #ddd;
      *zoom: 1;
    }
    
    .form-actions:before,
    .form-actions:after {
      display: table;
      content: "";
    }
    
    .form-actions:after {
      clear: both;
    }
    
    .uneditable-input {
      overflow: hidden;
      white-space: nowrap;
      cursor: not-allowed;
      background-color: #ffffff;
      border-color: #eee;
      -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025);
         -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025);
              box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025);
    }
    
    :-moz-placeholder {
      color: #999999;
    }
    
    ::-webkit-input-placeholder {
      color: #999999;
    }
    
    .help-block,
    .help-inline {
      color: #555555;
    }
    
    .help-block {
      display: block;
      margin-bottom: 9px;
    }
    
    .help-inline {
      display: inline-block;
      *display: inline;
      padding-left: 5px;
      vertical-align: middle;
      *zoom: 1;
    }
    
    .input-prepend,
    .input-append {
      margin-bottom: 5px;
    }
    
    .input-prepend input,
    .input-append input,
    .input-prepend select,
    .input-append select,
    .input-prepend .uneditable-input,
    .input-append .uneditable-input {
      position: relative;
      margin-bottom: 0;
      *margin-left: 0;
      vertical-align: middle;
      -webkit-border-radius: 0 3px 3px 0;
         -moz-border-radius: 0 3px 3px 0;
              border-radius: 0 3px 3px 0;
    }
    
    .input-prepend input:focus,
    .input-append input:focus,
    .input-prepend select:focus,
    .input-append select:focus,
    .input-prepend .uneditable-input:focus,
    .input-append .uneditable-input:focus {
      z-index: 2;
    }
    
    .input-prepend .uneditable-input,
    .input-append .uneditable-input {
      border-left-color: #ccc;
    }
    
    .input-prepend .add-on,
    .input-append .add-on {
      display: inline-block;
      width: auto;
      height: 18px;
      min-width: 16px;
      padding: 4px 5px;
      font-weight: normal;
      line-height: 18px;
      text-align: center;
      text-shadow: 0 1px 0 #ffffff;
      vertical-align: middle;
      background-color: #eeeeee;
      border: 1px solid #ccc;
    }
    
    .input-prepend .add-on,
    .input-append .add-on,
    .input-prepend .btn,
    .input-append .btn {
      margin-left: -1px;
      -webkit-border-radius: 0;
         -moz-border-radius: 0;
              border-radius: 0;
    }
    
    .input-prepend .active,
    .input-append .active {
      background-color: #a9dba9;
      border-color: #46a546;
    }
    
    .input-prepend .add-on,
    .input-prepend .btn {
      margin-right: -1px;
    }
    
    .input-prepend .add-on:first-child,
    .input-prepend .btn:first-child {
      -webkit-border-radius: 3px 0 0 3px;
         -moz-border-radius: 3px 0 0 3px;
              border-radius: 3px 0 0 3px;
    }
    
    .input-append input,
    .input-append select,
    .input-append .uneditable-input {
      -webkit-border-radius: 3px 0 0 3px;
         -moz-border-radius: 3px 0 0 3px;
              border-radius: 3px 0 0 3px;
    }
    
    .input-append .uneditable-input {
      border-right-color: #ccc;
      border-left-color: #eee;
    }
    
    .input-append .add-on:last-child,
    .input-append .btn:last-child {
      -webkit-border-radius: 0 3px 3px 0;
         -moz-border-radius: 0 3px 3px 0;
              border-radius: 0 3px 3px 0;
    }
    
    .input-prepend.input-append input,
    .input-prepend.input-append select,
    .input-prepend.input-append .uneditable-input {
      -webkit-border-radius: 0;
         -moz-border-radius: 0;
              border-radius: 0;
    }
    
    .input-prepend.input-append .add-on:first-child,
    .input-prepend.input-append .btn:first-child {
      margin-right: -1px;
      -webkit-border-radius: 3px 0 0 3px;
         -moz-border-radius: 3px 0 0 3px;
              border-radius: 3px 0 0 3px;
    }
    
    .input-prepend.input-append .add-on:last-child,
    .input-prepend.input-append .btn:last-child {
      margin-left: -1px;
      -webkit-border-radius: 0 3px 3px 0;
         -moz-border-radius: 0 3px 3px 0;
              border-radius: 0 3px 3px 0;
    }
    
    .search-query {
      padding-right: 14px;
      padding-right: 4px 9;
      padding-left: 14px;
      padding-left: 4px 9;
      /* IE7-8 doesn't have border-radius, so don't indent the padding */
    
      margin-bottom: 0;
      -webkit-border-radius: 14px;
         -moz-border-radius: 14px;
              border-radius: 14px;
    }
    
    .form-horizontal input,
    .form-horizontal textarea,
    .form-horizontal select,
    .form-horizontal .help-inline,
    .form-horizontal .uneditable-input,
    .form-horizontal .input-prepend,
    .form-horizontal .input-append {
      display: inline-block;
      *display: inline;
      margin-bottom: 0;
      *zoom: 1;
    }
    
    .form-horizontal .control-group {
      margin-bottom: 18px;
      *zoom: 1;
    }
    
    .form-horizontal .control-group:before,
    .form-horizontal .control-group:after {
      display: table;
      content: "";
    }
    
    .form-horizontal .control-group:after {
      clear: both;
    }
    
    .form-horizontal .control-label {
      float: left;
      width: 140px;
      padding-top: 5px;
      text-align: right;
    }
    
    .form-horizontal .controls {
      *display: inline-block;
      *padding-left: 20px;
      margin-left: 160px;
      *margin-left: 0;
    }
    
    .form-horizontal .controls:first-child {
      *padding-left: 160px;
    }
    
    .form-horizontal .help-block {
      margin-top: 9px;
      margin-bottom: 0;
    }
    
    .form-horizontal .form-actions {
      padding-left: 160px;
    }
    
    table {
      max-width: 100%;
      background-color: transparent;
      border-collapse: collapse;
      border-spacing: 0;
    }
    
    .table {
      width: 100%;
      margin-bottom: 18px;
    }
    
    .table th,
    .table td {
      padding: 8px;
      line-height: 18px;
      text-align: left;
      vertical-align: top;
      border-top: 1px solid #dddddd;
    }
    
    .table th {
      font-weight: bold;
    }
    
    .table thead th {
      vertical-align: bottom;
    }
    
    .table caption + thead tr:first-child th,
    .table caption + thead tr:first-child td,
    .table colgroup + thead tr:first-child th,
    .table colgroup + thead tr:first-child td,
    .table thead:first-child tr:first-child th,
    .table thead:first-child tr:first-child td {
      border-top: 0;
    }
    
    .table tbody + tbody {
      border-top: 2px solid #dddddd;
    }
    
    .table-condensed th,
    .table-condensed td {
      padding: 4px 5px;
    }
    
    .table-bordered {
      border: 1px solid #dddddd;
      border-collapse: separate;
      *border-collapse: collapsed;
      border-left: 0;
      -webkit-border-radius: 4px;
         -moz-border-radius: 4px;
              border-radius: 4px;
    }
    
    .table-bordered th,
    .table-bordered td {
      border-left: 1px solid #dddddd;
    }
    
    .table-striped tbody tr:nth-child(odd) td,
    .table-striped tbody tr:nth-child(odd) th {
      background-color: #f9f9f9;
    }
    
    .table tbody tr:hover td,
    .table tbody tr:hover th {
      background-color: #f5f5f5;
    }
    
    .well {
      min-height: 20px;
      padding: 19px;
      margin-bottom: 20px;
      background-color: #f5f5f5;
      border: 1px solid #eee;
      border: 1px solid rgba(0, 0, 0, 0.05);
      -webkit-border-radius: 4px;
         -moz-border-radius: 4px;
              border-radius: 4px;
      -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
         -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
              box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
    }
    
    .pagination {
      height: 46px;
      margin: 15px 0;
    }
    
    .pagination ul {
      display: inline-block;
      *display: inline;
      margin-bottom: 0;
      margin-left: 0;
      -webkit-border-radius: 3px;
         -moz-border-radius: 3px;
              border-radius: 3px;
      *zoom: 1;
      -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
         -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
              box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }
    
    .pagination li {
      display: inline;
    }
    
    .pagination a {
      float: left;
      padding: 0 14px;
      line-height: 34px;
      text-decoration: none;
      border: 1px solid #ddd;
      border-left-width: 0;
    }
    
    .pagination a:hover,
    .pagination .active a {
      background-color: #f5f5f5;
    }
    
    .pagination .active a {
      color: #999999;
      cursor: default;
    }
    
    .pagination li:first-child a {
      border-left-width: 1px;
      -webkit-border-radius: 3px 0 0 3px;
         -moz-border-radius: 3px 0 0 3px;
              border-radius: 3px 0 0 3px;
    }
    
    </style>
    <script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/admin/js/jquery.js"></script>
    <script type="text/javascript">        
      function selectKabupaten(id_prov){
       if(id_prov!="name"){
        loadData('kabupaten',id_prov);  
        $("#kecamatan_dropdown").html("<option value='-1'>Pilih kecamatan</option>"); 
       }else{
        $("#kabupaten_dropdown").html("<option value='-1'>Pilih kabupaten</option>");
        $("#kecamatan_dropdown").html("<option value='-1'>Pilih kecamatan</option>");  
       }
      }
    
      function selectKecamatan(id_kab){
       if(id_kab!="-1"){
        loadData('kecamatan',id_kab);
        $("#kelurahan_dropdown").html("<option value='-1'>Pilih kelurahan</option>");
       }else{
        $("#kecamatan_dropdown").html("<option value='-1'>Pilih kecamatan</option>");
        $("#kelurahan_dropdown").html("<option value='-1'>Pilih kelurahan</option>");  
       }
      }
    
      function selectKelurahan(id_kecamatan){
       if(id_kecamatan!="-1"){
        loadData('kelurahan',id_kecamatan);
       }else{
        $("#kelurahan_dropdown").html("<option value='-1'>Pilih kelurahan</option>");  
       }
      }
    
      function loadData(loadType,loadId){
       var dataString = 'loadType='+ loadType +'&loadId='+ loadId;
       $("#"+loadType+"_loader").show();
       $("#"+loadType+"_loader").fadeIn(400).html('Please wait... <img src="<?php echo base_url(); ?>assets/admin/img/loading.gif" />');
       $.ajax({
        type: "POST",
        url: "<?php echo base_url();?>c_mahasiswa/loadData",
        data: dataString,
        cache: false,
        success: function(data){
         $("#"+loadType+"_loader").hide();
         $("#"+loadType+"_dropdown").html("<option value='-1'>Pilih "+loadType+"</option>");  
         $("#"+loadType+"_dropdown").append(data);  
        }
       });
      }
    </script> 
    </head>
    <body>
    <div class="container"> 
    <div class="heading"> 
      <h1>Tambah Mahasiswa</h1>
    </div> 
      <div class="well">
      <form class="form-horizontal" action="<?php echo base_url(); ?>c_mahasiswa/submit_tambah_mahasiswa" method="POST" enctype="multipart/form-data">  
       <fieldset>
      <?php if(form_error('kode_mahasiswa') == FALSE){ ?>
      <div class="control-group">
      <?php }else{ ?>
      <div class="control-group warning">
      <?php } ?>
      <label class="control-label" for="input01">Kode Mahasiswa</label>
      <div class="controls">
      <input name="kode_mahasiswa" readonly value="<?php echo $kode_mahasiswa; ?>">
      <span class="help-inline"><?php echo form_error('kode_mahasiswa'); ?></span>
      </div>
      </div>
    
       
      <?php if(form_error('nama_mahasiswa') == FALSE){ ?>
      <div class="control-group">
      <?php }else{ ?>
      <div class="control-group warning">
      <?php } ?>
      <label class="control-label" for="input01">Nama Mahasiswa *</label> 
      <div class="controls">
        <input name="nama_mahasiswa" type="text" value="<?php echo set_value('nama_mahasiswa'); ?>">    
      <span class="help-inline"><?php echo form_error('nama_mahasiswa'); ?></span>    
      </div>
      </div>
      
      <?php if(form_error('alamat') == FALSE){ ?>
      <div class="control-group">
      <?php }else{ ?>
      <div class="control-group warning">
      <?php } ?>
      <label class="control-label" for="input01">Alamat *</label> 
      <div class="controls">
      <input name="alamat" type="text" value="<?php echo set_value('alamat'); ?>">
      <span class="help-inline"><?php echo form_error('alamat'); ?></span>    
      </div>
      </div>
      
      <?php if($list->num_rows > 0) ?>       
        
      <?php if(form_error('provinsi') == FALSE){ ?>
      <div class="control-group">
      <?php }else{ ?>
      <div class="control-group warning">
      <?php } ?>
      <label class="control-label" for="input01">Provinsi *</label>
      <div class="controls">
         <select name='provinsi' id='provinsi' onchange="selectKabupaten(this.options[this.selectedIndex].value)">
         <option value="">Pilih provinsi</option>
         <?php foreach($list->result() as $listElement){ ?>
         <option value="<?php echo $listElement->id; ?>"
         <?php echo set_select('provinsi', $listElement->id, (!empty($data) && $data == $listElement->nama_provinsi ? TRUE : FALSE )) ?>>
         <?php echo $listElement->nama_provinsi; ?></option>
         <?php } ?>
         </select> 
         <span class="help-inline"><?php echo form_error('provinsi'); ?></span> 
      </div>
       </div>
        
        <div>     
         <?php if(form_error('kabupaten') == FALSE){ ?>
         <div class="control-group">
         <?php }else{ ?>
         <div class="control-group warning">
         <?php } ?>    
         <label class="control-label" for="kabupaten">Kabupaten *</label>
         <div class="controls">
         <select name='kabupaten' id="kabupaten_dropdown" onchange="selectKecamatan(this.options[this.selectedIndex].value)">
          <option value="">Pilih Kabupaten</option>
         </select>
         <span class="help-inline" id="kabupaten_loader"><?php echo form_error('kabupaten'); ?></span> 
        </div>
        </div>    
           
         
         <?php if(form_error('kecamatan') == FALSE){ ?>
         <div class="control-group">
         <?php }else{ ?>
         <div class="control-group warning">
         <?php } ?>         
         <label class="control-label" for="kecamatan">Kecamatan *</label>
         <div class="controls">
         <select name='kecamatan' id="kecamatan_dropdown" onchange="selectKelurahan(this.options[this.selectedIndex].value)">
          <option value="">Pilih Kecamatan</option>
         </select>
         <span class="help-inline" id="kecamatan_loader"><?php echo form_error('kecamatan'); ?></span>         
         </div>
        </div>
           
         
         <?php if(form_error('kelurahan') == FALSE){ ?>
         <div class="control-group">
         <?php }else{ ?>
         <div class="control-group warning">
         <?php } ?>    
         <label class="control-label" for="kelurahan">Kelurahan *</label>
         <div class="controls">
         <select name='kelurahan' id="kelurahan_dropdown">
          <option value="">Pilih Kelurahan</option>
         </select>
         <span class="help-inline" id="kelurahan_loader"><?php echo form_error('kelurahan'); ?></span>
         </div>
        </div>
                 
           <div class="form-actions">
            <button type="submit" class="btn btn-primary">Simpan</button>
            <button class="btn">Batal</button>
           </div>
           </form>
          </div> </div>
    <!-- tabel -->   
    <div class="heading">
      <h1>Semua Mahasiswa berjumlah sebanyak: <?php echo $count; ?> Orang.</h1>
      </div>
       <div class="content">
     <table class="table table-striped table-bordered">
       <thead>
     <tr>
      <td class='center'>No</td>
      <td class='center'>Kode Mahasiswa</td>
      <td class='center'>Nama Mahasiswa</td>
      <td class='center'>Alamat</td>
      <td class='center'>Kelurahan</td>
         <td class='center'>Kecamatan</td>
         <td class='center'>Kabupaten</td>
         <td class='center'>Provinsi</td>
      <td colspan="2">Aksi</td>
     </tr>
       </thead>
       <tbody>
       <tr>
        <?php $no=1; 
         foreach($mahasiswa->result() as $row){ 
        ?>
        <td><?php echo $this->session->userdata('row')+$no; ?></td>
        <td><?php echo ucwords($row->kode_mahasiswa); ?></td>
        <td><?php echo ucwords($row->nama_mahasiswa); ?></td>
     <td><?php echo ucwords($row->alamat); ?></td>
     <td><?php echo ucwords($row->nama_kelurahan); ?></td>
     <td><?php echo ucwords($row->nama_kecamatan); ?></td>
     <td><?php echo ucwords($row->nama_kabupaten); ?></td>
     <td><?php echo ucwords($row->nama_provinsi); ?></td>
             
        <td border="0">
         <a href="#" onClick="if(confirm('Anda yakin HAPUS data ini? ')){document.location='<?php echo base_url()?>c_mahasiswa/hapus_mahasiswa/<?php echo $row->kode_mahasiswa; ?>'}" title="Hapus Mahasiswa" >Hapus</a>
        </td>
       </tr>
        <?php 
         $no++;
         } 
        ?>
        </tbody>
       </table>
       </form>
      <div class="pagination">
       <ul>
        <?php echo $this->pagination->create_links(); ?>
       </ul>
      </div>
      <hr />
      <div>
       <div class="span2">
       <footer>
       <p>&copy; <a href='http://jepretcode.blogspot.com'>jepretcode <?php $tahun = date("Y"); echo $tahun ?></p>
       </footer>
       </div>
      </div>
     </div>
      </body>
    </html>
    
  7. Sebelum menjalankan rubah pengaturan default controller di routes.php yang ada didalam folder application\config\ dengan mengganti "welcome" menjadi  "c_mahasiswa" karena kita tadi membuat controller dengan nama c_mahasiswa.php, lihat kode dibawah ini  
    $route['default_controller'] = "welcome";
    
    Menjadi
    
    $route['default_controller'] = "c_mahasiswa";
    
  8. Didalam isi controller yang kita buat tadi menggunakan redirect url langsung ke halaman c_mahasiswa/tambah_mahasiswa ketika menjalankan controller maka perlu pengaturan agar fungsi redirect bisa jalan dicodeigniter, untuk mengatasi kesalahan yang terjadi silahkan lihat cara mengatasi masalah error dicodeigniter
  9. Namun untuk lebih jelas lagi coba direfresh localhost dan lihat kesalahan atau error yang terjadi, "Fatal error: Call to undefined function redirect(), lalu atasi dengan merubah kode seperti dibawah ini didalam file autoload.php di folder application\config\  
    $autoload['helper'] = array();
    
    Menjadi 
    
    $autoload['helper'] = array('url','file','html','form');
    
  10. Dan masih didalam file autoload.php rubah pengaturan autoload libraries dengan kode seperti dibawah ini 
    $autoload['libraries'] = array();
    
    Menjadi 
    
    $autoload['libraries'] = array('database','pagination','session','form_validation');
    
  11. Kemudian lakukan langkah berikut dengan membuka file config.php yang ada didalam folder application\config\ lalu tambahkan key untuk encryption key seperti ini
    $config['encryption_key'] = '';
    
    Menjadi 
    
    $config['encryption_key'] = 'jepretcode2015';
    
  12. Hubungkan database dengan progran dengan membuka file database.php didalam folder apllication\config\ lalu isi username password dan nama database lihat contoh:
    $db['default']['hostname'] = 'localhost';
    $db['default']['username'] = 'root';
    $db['default']['password'] = 'mysql';
    $db['default']['database'] = 'kampus';
    $db['default']['dbdriver'] = 'mysql';
    
  13. Silahkan direfresh localhost dan apakah sudah berhasil?.

3 comments:

  1. gan ko pas pilih kabupaten ga jalan ya "please wait" terus??kayaknya masalah jquerymya.. yang jquery.js nya linknya ada ga gam

    ReplyDelete
  2. coba lihat disini https://www.dropbox.com/s/gje4jmjbjvkg09g/jepretcode_provinsi_kelurahan_views.rar?dl=0

    ReplyDelete
  3. mas kalo mau sekalian ngasih biaya kirim gimana?

    ReplyDelete