hmm, this would work if i knew what "data2" was in order to replace it. The problem is, data 2 could be anything. Is there anyway to just target and replace the whole line without knowing what is there to begin with? and without replacing the first line? what im trying to do is this: I have my form in form.php. I want to send the data to my data.txt, on the line designated for that perticular form, in this case its line 2. So whenever the user inputs a new value, line 2 would be replaced with that new input. so i never know what line 2 holds to replace it. thanks for your help.