I am currently trying to read a line in a text document and compare it to a set variable to change an image on my page.
The text document currently just says either "on" or "off" or "offline"
This is the code I am trying to implement:
<?php
$myFile = "status.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh,
fclose($fh);
$onData = "on";
$offData = "off";
$offlineData = "offline";
if($theData==$onData){
echo '<img src="image1.gif" width="61" height="60" alt="">';
}
elseif($theData==$offData){
echo '<img src="image2.gif" width="61" height="61" alt="">';
}
else($theData==$offlineData)
echo '<img src="image3.gif" width="61" height="61" alt="">';
?>
I am new to php programming so be easy on me. The first image works when I have the text document showing on (the on image works). The off image works as well when off is saved in the text document. When it gets to the offline image, I put offline in my text document and nothing shows up, its just a blank image. Anyone have any suggestions?