i need help making a simple php script. i don't know php and have been trying for hours to get this to work and i cant seem to do it. what i have is a filename and i want to find and replace a word in the file and then save it. this is the code i have and it doesn't do anything to the file. what am i doing wrong? it gets the filename from an html form and i echo'ed it and it was the right filename so thats not the problem. PHP: <? $filename = $_POST["filename"]; $data = fopen($filename, "a+"); $handle = fopen($filename, "r+"); $message = fread($handle, filesize($filename)); $data_to_save = eregi_replace("phone", "error", $message); fwrite($data,$data_to_save); fclose($data); ?> don't laugh at my code, i'm new at this, lol. Thanks for any help.