ok so im trying to code something in PHP. I've never done this before and basically i have a form, and then i want data from the form to be written to a text file. heres what i have so far:
<?php
if(file_exists("test.txt"))
{
$fp = fopen("test.txt", "r+");
fwrite($fp, $news);
fclose($fp);
}
else
{
$fp = fopen("test.txt", "wb");
fwrite($fp, $news);
fclose($fp);
}
?>
easy write? ok yeah. but i'm getting this:
Warning: fopen("test.txt","wb") - Permission denied in /home/public_html/htdocs/form_test.php on line 14
so it looks like i just dont have permission to write to the directory or something? i cant change the chmod i think cause its a windows server? not sure but thats what the ftp client is telling me... is there something i have to do to give my script rights to create/write to a file? thanks!
<?php
if(file_exists("test.txt"))
{
$fp = fopen("test.txt", "r+");
fwrite($fp, $news);
fclose($fp);
}
else
{
$fp = fopen("test.txt", "wb");
fwrite($fp, $news);
fclose($fp);
}
?>
easy write? ok yeah. but i'm getting this:
Warning: fopen("test.txt","wb") - Permission denied in /home/public_html/htdocs/form_test.php on line 14
so it looks like i just dont have permission to write to the directory or something? i cant change the chmod i think cause its a windows server? not sure but thats what the ftp client is telling me... is there something i have to do to give my script rights to create/write to a file? thanks!