Решение:
while($row = $result->fetch_assoc()) {
echo "<div><div class='popular-box'><div class='title'>" . $row["name"] . "<span>" . $row["description"] . "</span></div>"
. "<div class='img'><img src='" . $row["img"] . "'></div>"
. "<div class='price'>" . $row["price"] . " руб</div>"
. "<a href='#modal-order' data-toggle='modal' data-name=' . $row["name"] . ' class="modal-name"><span class='pe-7s-cart'></span></a></div></div>";
}
<div id="modal-order" class="modal fade" role="dialog">
<div class="modal-dialog call_modal">
<div class="modal-content">
<form id="form-order">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Оформить заказ на <span id="modal-name"></span></h4>
<p class="after-modal-title text-center">Оставьте свои данные и наши менеджеры свяжутся с вами для уточнения деталей</p>
</div>
<div class="modal-body">
<div class="form-group">
<input type="text" name="name" class="form-control" placeholder="Ваше имя" required>
</div>
<div class="form-group">
<input type="email" name="email" class="form-control" placeholder="Ваш E-mail" required>
</div>
<div class="form-group">
<input type="text" name="phone" class="form-control phone-mask" placeholder="+7 (999) 999-99-99" required>
</div>
<input type="hidden" name="formData" value="Оформление заказа">
<button type="submit" class="btn main-btn form-btn">Перезвоните мне</button>
</div>
</form>
</div>
</div>
$(document).ready(function() {
$(".modal-name").on("click", function() {
$("#modal-name").html($(this).data("name"));
});
});