# Function fopen error

**URL:** <https://forum.kirupa.com/t/function-fopen-error/31462>\
**Category:** Uncategorized\
**Created:** [September 23, 2003, 2:53am UTC](https://forum.kirupa.com/t/function-fopen-error/31462 "2003-09-23T02:53:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![claudio](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@claudio](https://forum.kirupa.com/u/claudio)\
**Post date:** [September 23, 2003, 2:53am UTC](https://forum.kirupa.com/t/function-fopen-error/31462/1 "2003-09-23T02:53:50Z")

</div>

Im having some problems with a PHP guestbook, something with fopen. When i try to write a message, i get the following error message(see attached file)  
This is the php code on post.php:

```php
<?php
// Name and Message required
if (( $name == "") || ( $message == "")) {
print "<p align=center>Preencha todos os campos!<p>";
}
else {
//Get the file
$file_name = "post.xml";
$file_pointer = fopen($file_name, "r+");
$lock = flock($file_pointer, LOCK_EX);
$file_read = fread($file_pointer, filesize($file_name));
$name = strip_tags($name, '');
$message = strip_tags($message, '');
$date = date ("j M Y");
$post = "

<post>
<p><span class=name>$name</span><span class=date> $date</span><br>$message</p>
</post>";
//Paste the updated info into the file
$post = stripslashes($post);
fwrite($file_pointer, "$post");
fclose($file_pointer);
print "<head><meta http-equiv=refresh content=0;URL=index.php></head>";
}
?>

```

Can anyone help me solve this problem? :cyclops:
