How to write to a file w/o overwritting text



Jabolin said:
Help I have an html file, and in that html file I located the spot that I wish to insert text. The problem is that I endup overwritting html that is below that spot. How can I make it not write over other text, but rather just push it farther down so that it does not overwrite previous code. Thanks

from what you say, you have a spot in the html file. You need to find the text between the 2 spots (beginning and ending of the string) and then use the replace function to write the new text input in place.
You can do these two steps in the following way:
1) find the string to be replaced with the function "strpos ", check for details at

with this function you get the positions of those 2 spots. You then need to substract them and get the string in between with the function "substr" (again check foa mare details at

2) after that you have the string which you want to replace. At this point you use the the ereg_replace or eregi_replace according to whether you want the finding and replacement to be case sensitive or not. Check at for more details.

One more point: Don;t forget to put in the string that will replace the original string the two spot points. It is a usual mistake and if you forget to do so, you will not be capable of replacing the strinf next time.

Hope it helps,