I have problem with AJAX and database. I don't know what I have now to do.
So, I have this AJAX code:
function showCity(str) {
if (str == "") {
document.getElementById("txtHint").innerHTML = "";
return;
} else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","rozpiski.php?q="+str,true);
xmlhttp.send();
}
}
I want:
When user select some option, the second select list shows value (after gets this values from database).
This is my code HTML:
AngliaAustriaBelgiaCzechyDaniaEstoniaFinlandiaFrancjaHolandiaIslandiaLichtensteinLuxembourgNiemcyNorwegiaPolskaSzwajcariaSzwecjaSłowacjaSłoweniaWyspy OwczeWęgryWłochyŁotwaAngliaAustriaBelgiaCzechyDaniaEstoniaFinlandiaFrancjaHolandiaIslandiaLichtensteinLuxembourgNiemcyNorwegiaPolskaSzwajcariaSzwecjaSłowacjaSłoweniaWyspy OwczeWęgryWłochyŁotwaAngliaAustriaBelgiaCzechyDaniaEstoniaFinlandiaFrancjaHolandiaIslandiaLichtensteinLuxembourgNiemcyNorwegiaPolskaSzwajcariaSzwecjaSłowacjaSłoweniaWyspy OwczeWęgryWłochyŁotwa
When the user in country3 select for example Polska, he gets in 2nd select cities from Polska. This cities are in database. How to do it?