Writing to a file that's not PHP_SELF
| From: | Kondwani Spike Mkandawire | Date: | Tue, 13 Aug 2002 18:32:51 +0000 |
| Subject: | Writing to a file that's not PHP_SELF | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-112386@lists.php.net to get a copy of this message | ||
Any idea why this is not working...
$file = fopen("Counter.txt", "r+");
$counter = fread($file, filesize("Counter.txt"));
fwrite($file, "$counter", strlen($counter));
echo '<form name="studVer" action = "ThisSameFile.php"
method="post">';
if(empty($SomeVariable...)){
$counter++;
// Here counter indicates that it has been incremented...
echo "counter = $counter";
// For some reason the updated value is not written
// to Counter.txt
fwrite($file, "$counter", strlen($counter));
fclose($file);
// Again this indicates that the value of $counter
// has actually gone up...
echo "counter = $counter";
I submit here...
The String in Counter.txt is always 0 why is this...