Jump to content

if statement to show different .txt files


chrules

Recommended Posts

Hi, i have a kind of blog like feature on my site, and i store the text in a seperate .txt file. I have been searching for a way to make so that

 

if "Button1" pressed
$myFile = "text1.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
fclose($fh);
echo $theData;

if "Button2" pressed
$myFile = "text2.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
fclose($fh);
echo $theData;

 

and so on.. is there any easy way to do this?

any help appreciated :P..

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.