I tried to create folder directory name “code”, and I want to save it to “status.txt”.
This is my code problem with received the unexpected T_CONSTANT_ENCAPSED_STRING.
if(is_writeable($newdir . "/status.txt")) {
if (fwrite($statusTxt, $statusCode . "," . $status . "," . $share . "," . $date . "," . $permission "\n")){
}
Is this way is correct to create a directory and save it to status.txt?
Below is the rest of the code.
Thank you so much, and appreciate for the help.
$newdir = "../../data/code";
umask(0007);
if(!file_exists($newdir))
{
mkdir($newdir, 02770);
$statusTxt = fopen($newdir. "/status.txt", "a");
}
if(is_writeable($newdir . "/status.txt")) {
if (fwrite($statusTxt, $statusCode . "," . $status . "," . $share . "," . $date . "," . $permission "\n")){
}
echo "<p>Your form has succesfully been submit!</p>";
}
fclose($statusTxt);
}
Change your code to:
Also, you may want to swap
\nout for the constantPHP_EOL.