Jump to content

[SOLVED] Display text file in a new page depending on which link has been clicked


Jeroen1000

Recommended Posts

Hi guys,

 

I'm missing a bit of info to get this done really.

 

When someone clicks on the "View Log" link, a second PHP page/ browser window should open display the contents of the log file (which is a simple text file). I have two log files and they should be displayed (if possible) by the same PHP page. Perhaps I'm a bit slow ATM but any hints are greatly appreciated.

 

 

<td<a href="">View Log </a></td>

In the simplest fashion

<td><a href="view-file.php?file=1.txt">View Log</a></td>
<td><a href="view-file.php?file=2.txt">View Log</a></td>
<?php
// view-file.php
$fileContents = file_get_contents($_GET['file']);
print $fileContents;
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.