I am trying to populate the data in a modal via AJAX, but i am unsure how to do so.
The link right now is <a href="viewmessage.php?id='.$row['ID']'">View</a>
Since there is only 1 Message in the Database, the number is 70.
I have seen multiple things online but I am not sure how to implement it.
the modal I want to use will have the ID = "messageModal" and I want to use 1 modal to populate every value. I can create a php page of viewmessage.php that will run the query and return the response.
viewmessage.php:
$query = "SELECT * FROM `tb_cform` WHERE `ID`='$id'";
$result = mysqli_query($link, $query);
while ($row = mysqli_fetch_assoc($result)){
$message = $row['subj'];
$message .= '<hr><br>';
$message .= $row['message'];
}
print $message