Write To A File
From PHP you are able to open up a file on your server and write to it. If the file does not exist we can create it, however if the file already exists you must chmod it to 777 so it will be writable.
When writing to a file, the first thing you need to do is to open up the file. We do that with this code:
<?php
$File = "YourFile.txt";
$Handle = fopen($File, 'w');
?>
Now we can use the fwrite command to add data to our file. We would do this as shown below:
<?php
$File = "YourFile.txt";
$Handle = fopen($File, 'w');
$Data = "Jane Doen";
fwrite($Handle, $Data);
$Data = "Bilbo Jonesn";
fwrite($Handle, $Data);
print "Data Written";
fclose($Handle);
?>
At the end of the file we use fclose to close the file we have been working with.
Hasan
It is a very nice WEB site I thing so. Well done, Keep it up. Yr well wisher.