Put the error message into a variable, then do something like this:
<?php
$filename = 'errors.txt';
$error = "Your error message in here";
// change this to the if an error was made
if (error was made) {
// Write error to our opened file.
if (!fwrite($handle, $error)) {
print "Cannot write to file ($filename)";
exit;
}
print "Success, wrote ($error) to file ($filename)";
fclose($handle);
}
?>
Hope that helps ya'
-Blake