Because I want the contents of the form written to this newly created file I have to specify it - $filename = "$thename"; - and PHP returns loads of errors as it is not yet able to find the file.
How do I get round this?
Code: Select all
<?PHP
if($page <= 0)
{
$page = 1;
}
$old_umask = umask(0);
$filename = "$thename";
if (!file_exists($filename)) {
touch($filename);
chmod($filename,0777);
}
$stuff = $news;
$fw = fopen($filename,"w+");
fwrite($fw,$stuff);
fclose($fw);
$fp = fopen('list.dat',"a+");
$line .= "|" . $HTTP_POST_VARS['thename'];
$line .= "\r\n";
fwrite($fp,$line );
fclose($fp);
?>Warning: touch() [function.touch]: Unable to create file because No such file or directory in /home/.sites/14/site467/web/test/testwrite.php on line 17
Warning: chmod() [function.chmod]: No such file or directory in /home/.sites/14/site467/web/test/testwrite.php on line 18
Warning: fwrite(): supplied argument is not a valid stream resource in /home/.sites/14/site467/web/test/testwrite.php on line 22
Warning: fclose(): supplied argument is not a valid stream resource in /home/.sites/14/site467/web/test/testwrite.php on line 23