javascript — показать сообщение из папки «Входящие» модально в переполнении стека

Я сделал входящие, создав массивы ($ from_user_array, $ type_array, $ subject_array и $ message_array) и показав, что находится в массивах, поместив его в HTML-таблицу с циклом for. Я скопировал код из w3schools, чтобы сделать модальные. Я знаю, что ошибка должна быть где-то в следующем коде, потому что все остальное работает:

 <?php foreach(range(0,$rowcount-1) as $i): ?>
<tr>
<td><?php echo $from_user_array[$i]; ?></td>
<td><?php echo $type_array[$i]; ?></td>
<td><button id = "<?php echo $i; ?>" onclick="click("<?php echo $i; ?>")">
Click to open</button></td>
</tr>

function click(ide){
<?php echo $i; ?>
// Get the modal
var modal = document.getElementById("myModal");

// Get the button that opens the modal
var btn = document.getElementById(ide);

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
}

// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
}
<div id="myModal" class="modal">

<div class="modal-content">
<span class="close">&times;</span>
<p><b> subject: </b></p> </br>
<?php echo $subject_array[$i]; ?>
<p><b> message: </b></p> </br>
<?php echo $message_array[$i]; ?>
</div>

</div>
<?php endforeach; ?>

кто-нибудь знает в чем проблема?

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …