I’m making a registration form, but can’t seem to write to text file. In this code, I’m putting a person’s real name in their file in acc/pplid/[name].txt The file isn’t writing at all – the echo doesn’t output anything. I’m running off of Microsoft Webmatrix on my computer. Thanks in advance!
$irlname = $_POST["irlname"];
$name = $_POST["username"];
$email = $_POST["email"];
$password = $_POST["password"];
$name = htmlentities($name);
echo $name;
file_put_contents("acc/pplid/".name.".txt", $irlname);
echo file_get_contents("acc/pplid/".$name.".txt");
Should be
unless
nameis defined else where, otherwise I’d say check the write permissions. Check the status of the folder withfile_existsoris_dirprior tofile_put_contents.Example