Ok, first you really don't want to disable warnings, they let you catch errors just like this. Now on to the rest. The first warning is stating that you don't have access rights to the file or the directory that you are trying to access. Check the permissions of the directory and file to make sure that what-ever php is running as has permission to write to that directory/file. In the fopen function, "w" creates a new file or overwrites an existing one. It does not append to an existing one. "w+" or "a" will accomplish this. The rest of the error messages are a result of the file not being opened, hence the $fp variable is not a valid file handle. You can stop the rest of the errors and warnings if you check to make sure you were successfull in opening the file. You can see more about this here: http://www.php.net/manual/en/function.fopen.php
----- Original Message ----- From: "Andy" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, December 16, 2002 12:54 PM Subject: Re: [PHP-WIN] Warning messages > Here is the code and warning messages > > <? > if (($email=="") || ($name=="") || ($phone=="")) > { > echo "Please fill out the guestbook completely before submitting."; > } > else > { > $fp = fopen("guestbook.txt", "w"); //w will append or create a new file > flock ($fp, LOCK_EX); //lock the file > > fwrite($fp, "$name signed the guestbook. \nHis e-mail address was $email > \nHis phone number was $phone\n\n"); > > flock ($fp, LOCK_UN); //unlock the file > fclose($fp); > > mail("[EMAIL PROTECTED]", "Guestbook entry added", wordwrap("$name > signed the guestbook. \nHis e-mail address was $email \nHis phone number was > $phone", 72, "\n", 1), "Return-Path: > <[EMAIL PROTECTED]>\nForm: Andrew Davey"); > > mail("$email", "Thank you for signing my Guestbook", wordwrap("Thank you, > $name, for signing my Guestbook.", 72, "\n", 1), "Return-path: > <[EMAIL PROTECTED]>\nForm: Andrew Davey"); > echo "<font face=Verdana size=1>Thank you, " . $name . ", for signing my > Guestbook."; > } > ?> > > Which give me the following errors: > > Warning: fopen("guestbook.txt", "w") - Permission denied in > /home/.sites/112/site154/web/guestbook_post.php on line 15 > > Warning: flock(): supplied argument is not a valid File-Handle resource in > /home/.sites/112/site154/web/guestbook_post.php on line 16 > > Warning: fwrite(): supplied argument is not a valid File-Handle resource in > /home/.sites/112/site154/web/guestbook_post.php on line 18 > > Warning: flock(): supplied argument is not a valid File-Handle resource in > /home/.sites/112/site154/web/guestbook_post.php on line 20 > > Warning: fclose(): supplied argument is not a valid File-Handle resource in > /home/.sites/112/site154/web/guestbook_post.php on line 21 > > The code i used was copied directly from a book, as i am a complete > beginner, so answers need to be idiot proof > :o) > > Andy > > > "Stephen Edmonds" <[EMAIL PROTECTED]> wrote in message > 005501c2a532$17a348c0$6d00a8c0@q">news:005501c2a532$17a348c0$6d00a8c0@q... > > That means you have an error in your use of fwrite.... its not a proper > > 'file pointer'. Its not a setting you can change in your php.ini, as it is > > cause by a problem with your script. In fact, your script should not work > > because of the error. > > > > If you paste the code and what your script does, I may be able to help > > > > Stephen > > > > ----- Original Message ----- > > From: "Andy" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Monday, December 16, 2002 6:19 PM > > Subject: [PHP-WIN] Warning messages > > > > > > > what do I change in my php.ini file to stop these annoying warning > > notices? > > > I have looked at the ini file but I am unsure what to change. I still > > want > > > to see error messages but the warning notices are doing my head in. > > > > > > An example would be: > > > Warning: fwrite(): supplied argument is not a valid File-Handle resource > > in > > > /home/.sites/112/site154/web/guestbook_post.php on line 18 > > > > > > Thank you > > > > > > > > > > > > -- > > > PHP Windows Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php