Viewing and editting a text file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
chris-ramsey
Forum Newbie
Posts: 5
Joined: Fri Feb 20, 2009 8:35 am

Viewing and editting a text file

Post by chris-ramsey »

Hi all.

I have gotone final thing that my website requires for a college project. I have been putting it off for a while and concentrating on everything else which I can do!

I have searched the internet endlessly for code and I just keep coming across code which doesnt work/doesnt make sense. :banghead:

I was wondering if someone here would be able to help me? I am looking to be able to open up a new pae from within the webiste. This page needs to display a txt box with the contents of a text file which will be saved in the same directory as the website. The text file is called, IP_Log.txt. The user must then be able to edit the contents of the text file and then click a button which will save the contents and overwrite the file.

Thank you in advance to anyone that can help me. This forum has been very helpful before!
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: Viewing and editting a text file

Post by jayshields »

I'm surprised you haven't found good examples on the 'net, although it's very simple to do yourself. You'll need fopen(), fread() and fwrite(). You could've found those functions pretty easily by just searching the PHP manual.
User avatar
tom456
Forum Newbie
Posts: 22
Joined: Fri Aug 15, 2008 2:38 am

Re: Viewing and editting a text file

Post by tom456 »

Post Reply