submit form dependent dropdown to a table and show in the table the name instead of id issue

Hello stackoverflow community, i have a doubt on how to do this:
-im making a country city state like , dependent dropdown, and im trying to insert into a table in database the form submission.. i’m having an issue on how to submit into the table, the country_name. i have the following in the php form (alredy submitting the id’s instead of names of the countries:

<form method="POST" action="">
<div class="form-group">
<label for="distrito">Distrito</label>
<select class="form-control" name="distrito" id="distrito_name">
<option value="">Seleccione o distrito</option>
<?php
require_once "db.php";
$result = mysqli_query($conn,"SELECT * FROM distrito");
while($row = mysqli_fetch_array($result)) {
?>
<option value="<?php echo $row['id'];?>"><?php echo $row["distrito_name"];?></option>
<?php
}
?>
</select>
</div>
<div class="form-group">
<label for="concelho">Seleccione o concelho</label>
<select class="form-control" name="concelho" id="concelho_name">
</select>
</div>                        
<div class="form-group">
<label for="freguesia">Freguesia</label>
<select class="form-control" name="freguesia" id="freguesia_name">
</select>
</div>
</div>
</div>
</div>
</div> 
</div>
<script>
$(document).ready(function() {
$('#distrito_name').on('change', function() {
var distrito_id = this.value;
$.ajax({
url: "concelho-by-distrito.php",
type: "POST",
data: {
distrito_id: distrito_id
},
cache: false,
success: function(result){
$("#concelho_name").html(result);
$('#freguesia_name').html('<option value="">Seleccione o concelho primeiro</option>'); 
}
});
});    
$('#concelho_name').on('change', function() {
var concelho_id = this.value;
$.ajax({
url: "freguesia-by-concelho.php",
type: "POST",
data: {
concelho_id: concelho_id
},
cache: false,
success: function(result){
$("#freguesia_name").html(result);
}
});
});
});
</script>
<button type="submit" name="submit" class="btn btn-primary">Save Event</button>

and i have the following in the data submission code wich is in a separate page: the connection to the database and this:

<?php
  if (isset($_REQUEST['distrito_id'])) {
    $i=implode(',', $_REQUEST['distrito_id']);
      $query = "SELECT distrito_name FROM distrito where id IN ($i)";
$result = $db_name->query($query);
if ($result->num_rows > 0) {
  // output data of each row
  while($row = $result->fetch_assoc()) {
    echo $row["distrito_name"]."<br>";
  }
} else {
  echo "0 results";
}
$db_name->close();
 }

?> 
<?php
if(isset($_POST['submit']))
{
 
$distrito = $_POST['distrito']; 
$query = "INSERT INTO table (distrito) VALUES '$distrito' 
$query_run = mysqli_query($con, $query);
}

if someone can, please help me make this, thanks in advance