<?php 
if(isset($_GET['propinsi'])) {
    echo 
"<select name='kabupaten' onChange=\"jin_ajax_req('?kabupaten=' + this.value + '', 'div_kecamatan');\">";
    echo 
'<option>Pilih Kabupaten</option>';
    echo 
'<option>Cirebon</option>';
    echo 
'<option>Tegal</option>';
    echo 
'<option>Pekalongan</option>';
    echo 
'</select>';
    echo 
'<div id="div_kecamatan" class="inline"></div>';
    exit();
}
if(isset(
$_GET['kabupaten'])) {
    echo 
"<select name='kecamatan' onChange=\"jin_ajax_req('?kecamatan=' + this.value + '', 'div_desa');\">";
    echo 
'<option>Pilih Kecamatan</option>';
    echo 
'<option>Kejaksan</option>';
    echo 
'<option>Pesisir</option>';
    echo 
'</select>';
    echo 
'<div id="div_desa" class="inline"></div>';
    exit();
}
if(isset(
$_GET['kecamatan'])) {
    echo 
'<select name="desa">';
    echo 
'<option>Pilih Desa</option>';
    echo 
'<option>Citemu</option>';
    echo 
'<option>Mundu</option>';
    echo 
'</select>';
    exit();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Test Chain Unlimited Select</title>
<style>
.inline {
    display: inline;
}
</style>
<script type="text/javascript">
// AJAX konten Jin 
var http_request = false;
function jin_ajax_req(url,target) {
 
        http_request = false;
 
        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                //http_request.overrideMimeType('multipart/form-data');
                // zu dieser Zeile siehe weiter unten
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
 
        if (!http_request) {
            alert('Ende :(');
            return false;
        }
        http_request.onreadystatechange = alertInhalt;
        http_request.open('GET', url, true);
        http_request.send(null);
 
 function alertInhalt() {
        if (http_request.readyState == 4) {
              var answer = http_request.responseText;
              if(document.getElementById(target).innerHTML != answer){
                document.getElementById(target).innerHTML = answer;
              }
              else{
                document.getElementById(target).innerHTML = "";
              }
        } else {
         document.getElementById(target).innerHTML = "Sedang Memuat...";
        }
 }

}
// end
</script>
</head>

<body>
Pilih Propinsi:
<select name="propinsi" onChange="jin_ajax_req('?propinsi=' + this.value + '', 'div_kabupaten');">
<option>Pilih Propinsi</option>
<option>Jawa Barat</option>
<option>Jawa Tengah</option>
<option>Jawa Timur</option>
<option>Kalimantan</option>
</select>
<div id="div_kabupaten" class="inline"></div>
 
</body>
</html>