Kayıt işlemleri vs kodlarını da görmek lazım.
Hocam js dosyasının son kısmı
$(document).ready(function(){
const $sehir_select = $("select[name=sehir]");
const $ilce_select = $("select[name=ilce]");
const $save_button = $("button[data-role=save]");
$sehir_select.find("option").eq(0).siblings().remove();
for(let i=0; i<data.length; i++){
$sehir_select.append(`<option value="${data[i].plaka}">${data[i].il}</option>`);
}
$sehir_select.on("change",function(){
const target = $(this).val();
const targetData = data.find(function(x){return x.plaka==target});
if(!targetData) { alert("Bu ile ait ilçe kaydı bulunamadı."); return; }
$ilce_select.find('option').eq(0).prop("selected",true).siblings().remove();
$save_button.prop("disabled",true);
for(let i=0; i<targetData.ilceleri.length; i++) {
$ilce_select.append(`<option value="${targetData.ilceleri[i]}">${targetData.ilceleri[i]}</option>`);
}
$ilce_select.prop("disabled",false);
});
$ilce_select.on("change", function(){
const selectedSehir = $sehir_select.val();
const selectedIlce = $(this).val();
if(selectedIlce && selectedIlce!="0") $save_button.prop("disabled",false);
})
// Seçim yaptıralım.
var selectedData = {
il: "Adana",
plaka: 1,
ilce: "Ceyhan"
};
setSelectBoxes(selectedData);
})
Postu ise direk çekiyor
if ($_POST) {
$adsoyad = post('adsoyad');
$telefon = post('telefon');
$adres = post('adres');
$il = post('sehir');
$ilce = post('ilce');
$yontem = post('yontem');
$urun_id = post('urun_id');