Jump to content

Open A txt File From Web Location


zunebuggy

Recommended Posts

I created a website for my Mother's civic association.  She is in charge of the associations announcements.  She does not know HMTL.  I am new to PHP. I want to create her Announcement/Event page using PHP and want her to be able to simply write the events in notepad and I will give her instructions on how to upload that txt file to the website.  From there I want my PHP page to read the txt file and display the contents on the page.  If someone can just help me get the part that can open and reading each line of a txt file from a web location, I think I can handle outputting the results to the Announcement page. 

 

I am an old vb programmer and I need something that is the equivalent of this below, but in PHP and from a web location and not a drive:

 

Open myFileLocation & "/" & myFileName For Input As #1

      Do While Not EOF(1)

             Line Input #1, myLine

               ' do stuff here

      Loop

Close #1

 

Thank you.

 

 

Link to comment
Share on other sites

Assuming you don't want to deal with the trouble of learning to use a database there are better solutions.

 

The simplest one is to store the text for the announcements in a simple text file on the web server. When someone goes to the announcements page it will read the text from that file to display it. Then, when your mom wants to edit that page, give her a page which loads the text file into a form and allows here to edit it and submit. When submitted it will update the text file. No need for her to write in notepad, save it, and then upload it.

 

And, you can easily expand that solution to use a "rick text" type editor such as this forum uses for writing your posts that allows you to add properties such as bold, italic, underline etc. There are plenty of free options available and you can easily implement them to store the content in a text file as above.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.