The code below works great to write to a txt file on a remote server. However I just installed apache 2 and the latest php4.3 and it doesn't seem to work. my register_globals is on! I can't seem to figure out why it doesn't work? any help is greatly appreciated!!
Also is it possible to save a new txt file instead of always writting or re-writting over the same one?
thanks in advance,
t-
<?
function WriteToFile($URL, $Description){
$TheFile="data.txt";
$Open=fopen($TheFile, "w+");
fwrite ($Open, "$URL\t$Description\n");
fclose ($Open);
}
?>
<html>
<title>refresh</title><body>
<?php
$CallFunction=WriteToFile
($Array["URL"], "variable=".$Array["Description"]);
?>
done
</body>
</html>
writing to a txt file
Moderator: General Moderators
Thanks for the reply!!
Hey McGruff,
I do not see the reflected changes in the txt file. the text file is not being overwritten with the new data.
I have one page with text fields in html. those txt fileds publish to the php script I posted previously. It works fine on a common server- but not on my local apache2 php4.3 setup. i have a hunch its my config file. but not positive. It could also be a path- however everything is setup relative to each other- all in the same folder as it was on the remote server.
thnaks for your help!
t-
I do not see the reflected changes in the txt file. the text file is not being overwritten with the new data.
I have one page with text fields in html. those txt fileds publish to the php script I posted previously. It works fine on a common server- but not on my local apache2 php4.3 setup. i have a hunch its my config file. but not positive. It could also be a path- however everything is setup relative to each other- all in the same folder as it was on the remote server.
thnaks for your help!
t-
On the query about creating new files.. if u fopen a file that doesn't exist, in most modes it creates it. i think "r" might be the odd one out u'd have to check that:-
http://www.php.net/fopen
have fun
Trill
http://www.php.net/fopen
have fun
Trill