Jump to content


writing to file on server, beginner help

  • Please log in to reply
3 replies to this topic

#1 Jen

  • Members
  • PipPip
  • Member
  • 16 posts

Posted 07 August 2006 - 06:25 PM

Hi all,
I am trying to teach myself a little PHP so I can put a news box on a website I'm designing.  The news will be just a simple paragraph, not a blog, and it needs to be updated periodically by the site's owner.  I plan to store the news content in a separate news.txt file on the server, and just use an include() to put the content onto the web page.  What I need to know is how to use a form to input the news content and then write it to news.txt.

#2 wildteen88

  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 07 August 2006 - 06:35 PM

To write a file on the server you can use fopen, fwrite and and fclose. All these functions are explained over at http://www.php.net/fopen

I'll post a simple example in a minute

#3 mitchellm

  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 07 August 2006 - 07:01 PM

Jen, perhaps you'd be interested in a script I wrote not too long ago.

It's very simple, and was originally used for a 'website notepad.' However, it'd be perfect for you.

If you're interested, I'll send you the zip file with the files and instructions.

#4 Jen

  • Members
  • PipPip
  • Member
  • 16 posts

Posted 07 August 2006 - 07:19 PM

Yes, michellm, that would be helpful.  Please send it to jenbrandner@yahoo.com.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users