View Full Version : Calling PHP script with file name

09-25-2008, 05:36 PM
Here is what I am doing

$count = 0;
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {$count++;
print("<a href=\"".$file."\">".$file."</a><br />\n");
echo '<br /><br /><a href="..">Return</a>';

I am listing all the files in a directory. For example: test.txt. What I want to accomplish is that whenever I click on the filename, I want to call a php script (or maybe in the same script) to perform some operation on the content of the test.txt file and give me the output for test.txt

How can I do it?

Please help!

09-26-2008, 12:21 AM
The script to get a file contents is:

file_get_contents('page here');

If thats what you needed. :o