PHP Classes

File: data_wilayah_semua.php

Recommend this page to a friend!
  Classes of Usman Didi Khamdani   Indonesian Territory Class   data_wilayah_semua.php   Download  
File: data_wilayah_semua.php
Role: Example script
Content type: text/plain
Description: Obtaining the name of region within a territory (complete up to the lowest level)
Class: Indonesian Territory Class
Obtain the name of the territory of Indonesia
Author: By
Last change:
Date: 6 years ago
Size: 1,324 bytes
 

Contents

Class file image Download
<?php

date_default_timezone_set
('Asia/Jakarta'); // reference => http://www.php.net/manual/en/timezones.php
set_time_limit(0);

echo
'<form><input name="mst_kode_wilayah" value="'; echo isset($_GET['mst_kode_wilayah']) && trim($_GET['mst_kode_wilayah']) != "" ? $_GET['mst_kode_wilayah'] : "000000"; echo '"><input type="submit" value="Tampilkan"></form>';

if(isset(
$_GET['mst_kode_wilayah'])) {
   
$mst_kode_wilayah = $_GET['mst_kode_wilayah'];

    include_once(
"idterritory.php");

   
$idt = new IDTerritory;

   
$data = $idt::getAllData($mst_kode_wilayah);

    echo
"<hr />";

    if(
count($data)>0) {
        foreach (
$data as $data) {
           
$nama = $data['nama'];
           
$kode_wilayah = $data['kode_wilayah'];
           
$mst_kode_wilayah = $data['mst_kode_wilayah'];
           
$id_wilayah = $data['id_wilayah'];

            if(
$id_wilayah==1) {
               
$status = 'Propinsi';
            } elseif(
$id_wilayah==2) {
               
$status = 'Kabupaten/Kota';
            } elseif(
$id_wilayah==3) {
               
$status = 'Kecamatan';
            } else {
               
$status = 'Desa/Kelurahan';
            }

           
// echo "<br />Kode Master Wilayah = $mst_kode_wilayah, Kode Wilayah = $kode_wilayah, Nama Wilayah = $nama, Status = $status";
           
echo "<br />$mst_kode_wilayah;$kode_wilayah;$nama;$id_wilayah";
        }
    } else {
        echo
"<br />Data wilayah $mst_kode_wilayah tidak ditemukan";
    }
}

?>