Page 1 of 1

Filename like the user name

Posted: Sat Nov 07, 2009 3:46 pm
by ramya4myself
I am creating a form and storing the values in file. Could anyone please tell me how to write a code in php for creating a filename based on the user name as in the form.

Thanks
Ramya

Re: Filename like the user name

Posted: Sat Nov 07, 2009 5:46 pm
by Colwell
Do you mean creating a new file or altering an existing file?

Re: Filename like the user name

Posted: Sat Nov 07, 2009 6:27 pm
by ramya4myself
I want to create new file for every new user who fills the form but the file name should be in the user's name which the user enters.

Re: Filename like the user name

Posted: Sun Nov 08, 2009 1:50 am
by ramya4myself
Thanks.
It worked by using the code

Code: Select all

$file=$name;
But I want the filename in a particular directory like PHP/Peter.txt. This is not happening even though I set the permissions of the file and the directory. It displays an error "fopen cannot open directory: Is a directory /PHP/Peter.txt ". Could anyone please help me with this.