Forum Moderators: coopster

Message Too Old, No Replies

PHP and Text Files

         

boyx

11:37 am on Sep 1, 2005 (gmt 0)



Can anyone help with this simple php scripting,

I want to create or edit txt files each with 3 variables in it.

there is a field where you anter a name,
if the file name.txt exists id like to be able to edit
the fields.

If it doesnt exist id like it to be created and presented
with a form to enter the 3 fields.

Anyone any ideas?

dreamcatcher

5:14 pm on Sep 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



boyx, welcome to Webmaster World. :)

This is actually fairly straight forward. To write to flat text files you need to look into the following PHP file handling functions:

fopen
[uk.php.net...]

fwrite
[uk.php.net...]

fclose
[uk.php.net...]

To read from the file, try the file() function:
[uk.php.net...]

Hope that gets you started.

dc