"; //Get user input and build text to be stored in file $guestEmail = strip_tags($_POST['email']); $messageText = " $guestName : "; $messageText = $messageText . strip_tags($_POST['message']) . PHP_EOL; //open file to append text to the file $fp = fopen("gb.dat", "ab"); if ( !fp ) die("Can not open file"); //lock file for writing flock($fp, LOCK_EX) or die ("Can not lock file"); fwrite($fp, $messageText); fclose($fp); //This also releases the lock on file $_POST['guestname'] = $_POST['email'] = $_POST['message'] = ""; //to make sure current values are not used in case user clicks //the submit button without providing any values } elseif ($_POST['submitButton']) print " Please provide complete information "; ?>

Please leave a message in our guestbook.




"; ?>