Put an id in your <select name="X"> code like <select name="X" id ="X">
Put another select like <select name="Y" id="Y">. Which will be blank.
put this jquery in your page.
$("X").on("change",function(){
var x_value=$("X").val();
$.ajax({
url:'ajax.php',
data:{brand:x_value},
type: 'post',
success : function(resp){
$("#Y").html(resp);
},
error : function(resp){}
});
});
in your ajax.php add the query.
<?php
$row = mysqli_query("SELECT modelName from modele WHERE brandName =".$_POST['brand']);
while($row2 = mysqli_fetch_array($row))
echo '<option value="' . $row2['modelId'] . '">' . $row2['modelName'] . '</option>
?>
Hopefully it will work. Please tell me if you need anything.