Загрузить jquery в заголовке:
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
Взять идентификатор в поле выбора:
<select name="type" id="type" class="form-control">
Используйте вызов ajax для получения и отображения данных в поле ввода:
$(document).on('change','#type',function(e) {
e.preventDefault();
$.ajax({
url: '#Call funtion from here#',
type: 'POST',
dataType : 'json',
data: {type:$('#type').val()},
success: function(response) {
if(response.status == true) {
// Check data using console log for debug
console.log(response.data);
// Set data
$('#id_vendor').val(response.data....);
}
}
});
});
Php:
return json_encode([
'status' => true
'data' => $stmt
]);