maybe you should OPEN before you read
$edit_file=fopen($filename, "w+");
$file_read=fread($edit_file, 90000);
also in several places
you use only = instead of ==
in your IF STATEMENTS
if ($ref="form.php") should be: if ($ref=="form.php")
and so on ....
about your first error Line 9
check out that your file permissions are 755 or 644 CHMOD
And maybe that file is empty - nothing to read?
I dont remember, but maybe reading an empty file will give some error.
best to use a check of ... filesize( $filename) ... BEFORE trying to OPEN file.
and you also should turn on DEBUG Mode
whilestarting your php page like this:
<?php
error_reporting(2047); // debug
//rest of page