Forum Moderators: coopster
<html>
<head>
<title>Untitled Document</title>
<style type="text/css">
<!--
table { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px; color: 920000; border-color: 920000 920000 920000 #920000; border-style: dotted; border-top-width: thin; border-right-width: thin; border-bottom-width: thin; border-left-width: thin}
-->
</style>
</head>
<body bgcolor="#F9F9F9" text="#4A4A4A" link="920000" alink="920000" vlink="920000">
<div align="center">
<br>
<table width="214" height="114" border="0" name="t1" bordercolor="920000">
<tr>
<td width="214" height="114" align="left" valign="bottom">
<center><b>thesunisleaving.t35.com</b></center>
<br>
<?php
$file = "file.txt";
if($fp=fopen($file, "r+"))
{
while($line=trim(fgets($fp)))
{
$text .= $line;
}
echo str_replace("\n", "
", $text);
}
else
{
echo 'Unable to open file';
?>
</td>
</tr>
<tr>
<td height="18" align="left" valign="middle"> </td>
</tr>
</table>
</div>
</body>
</html>
if i save it as .php
-i get absolutely nothing
if i save it as .html
-i can see the html parts of the page yet the text file read (php part) does not show.
:/ ive spent like 3 hours on this over tonight and last night and i cant get the bloody thing to work.....very stressful!
create a file called info.php and it should contain the following three lines and nothing but (everything between but not including the "begin" and "end"):
begin file
<?php
phpinfo();
?>
end file
Then open up that file. If that works, go back to your original file and outside any conditional statements, just put a line like
echo "PHP is working";
If that works, put another one after the if statement
echo "File successfully opened";
Keep doing that and you should see where the problem is right quick.
You said you were a real beginner - you're not working locally and opening the PHP file straight in your browser without going through the server are you?
Tom