I'm trying to figure our how to download a text file made from content that's on the page. In my case it's just a chat log in plain text form. I have a button in the admin panel that you can use to view the chat log, and another one that should be used to download the said chat log.
An example of how the log is formatted:
2019-01-30 08:38:00 This is a chat log.
That's everything there is on the page.
The button I'm using to view the said chat log.
<td><a href="chatlog.php?
user='.$rows['user'].'&reportedby='.$rows['reported_by'].'" class="btn btn-
primary btn-sm">View messages</a></td>
<?php session_start();
include 'includes/db.php';
$sender = $_GET['user'];
$receiver = $_GET['reportedby'];
$query = "SELECT * FROM messages WHERE sender='$sender' AND receiver='$receiver'";
$runq = mysqli_query($conn,$query);
while($rows = mysqli_fetch_assoc($runq)) {
echo($rows['date'] . " " . $rows['content']."<br/>");
}
?>