Jeroen1000 Posted October 12, 2009 Share Posted October 12, 2009 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> Link to comment https://forums.phpfreaks.com/topic/177425-solved-display-text-file-in-a-new-page-depending-on-which-link-has-been-clicked/ Share on other sites More sharing options...
JonnoTheDev Posted October 12, 2009 Share Posted October 12, 2009 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; ?> Link to comment https://forums.phpfreaks.com/topic/177425-solved-display-text-file-in-a-new-page-depending-on-which-link-has-been-clicked/#findComment-935503 Share on other sites More sharing options...
Jeroen1000 Posted October 13, 2009 Author Share Posted October 13, 2009 Thanks Neil. I was trying to display it within the same page but this will be a lot easier! I assume 1.txt and 2.txt can be variables that contain the actual filename? Link to comment https://forums.phpfreaks.com/topic/177425-solved-display-text-file-in-a-new-page-depending-on-which-link-has-been-clicked/#findComment-935930 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.