Всем доброго времени суток. В скрытое поле модальной формы отправляется id записи, но содержимое модального окна не соответствует этому id. Как это исправить?
<?php
$con=mysqli_connect("localhost","root","","hotel");
$result=mysqli_query($con,"Select * from room where (datestart < '$datearrive' or dateend >'$dateliave') ");
while ($row=mysqli_fetch_array($result)){
$id_room=$row['id_room'];
$adres=$row['name'];
$price=$row['price'];
?>
<section class='section section-md bg-secondary-4 text-center text-sm-left' style='padding-top: 65px;'>
<div class='shell'>
<div class='range range-50 range-md-justify range-sm-reverse'>
<div class='cell-sm-6 cell-md-5'>
<?php
echo" <h2 ><a href='book.php?room=$id_room'>$adres</a></h2>";
?>
<p></p>
<button data-room-id="<?php echo $id_room; ?>" class="btn btn-primary open-modal">Забронировать</button>
</div>
</div>
</div>
</section>
<?php
}
?>
<script>
$('.open-modal').click(function(){
let roomId = $(this).attr('data-room-id');
$('#data-room-id').val(roomId);
$('#myModal').modal('show');
})
</script>
<form action="reserve.php">
<input type="hidden" id="data-room-id">
<div id="myModal" class="modal fade" >
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class='modal-title'><?php echo "$adres"; ?> </h4>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button class="button button-primary button-square button-block button-effect-ujarak" type="submit" name="submit" ><span>check availability </span></button>
</div>
</div>
</div>
</div>
</form>