Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

OK this is a tricky one. creating a txt file on a server.

well it is for me.



8:15 pm on Sep 4, 2002 (gmt 0)

Inactive Member
Account Expired


Ok i need to have a form that makes a txt file on the server.

i am a huge php n00b, i'd imagine making a database would be more efficient but i dont have a clue where to start on that one.

So is there anything i can add to a form to make a file on the forms contents on my server, i imagine i would have to set a directory 777 as well, but thats no probs.

Cheers guys

8:39 pm on Sept 4, 2002 (gmt 0)

Preferred Member

10+ Year Member

joined:May 15, 2001
votes: 0

Welcome to the boards Boycee.

Not really done much php yet, but if its like Perl (which I think it is), just take your form input, use an open function to open a file for writing (or appending depending on your requirements), print the form contents to the filehandle and that should be it. If the file didnt previously exist, one should be created when you use the open function.

Someone else can probably help with more specifics.

8:47 pm on Sept 4, 2002 (gmt 0)


WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
votes: 0

Welcome to WebmasterWorld [webmasterworld.com] boycee

Robber has it, here are the specifics.

use fopen [php.net] also look at fwirte and fclose in there.

I would do
$filepointer = fopen('fullpath','a+');
means - set filepointer to the file specified in fullpath and open it for appending, if it does not exist, create it