Closed Thread Icon

Topic awaiting preservation: how to read/write from form filed to txt file (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12913" title="Pages that link to Topic awaiting preservation: how to read/write from form filed to txt file (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: how to read/write from form filed to txt file <span class="small">(Page 1 of 1)</span>\

 
patric design
Bipolar (III) Inmate

From: 290 km/h, fast lane, Autobahn, Germany
Insane since: Feb 2001

posted posted 10-01-2003 09:24

I am currently writing a personal start page so that I'll have bookmarks, searches in reach everywhere I go. What I would also like to have on there is some sort of an online notepad. I've seen something similar in the control panel of a bulletin board. It is basically a text field with a save and a reset button. On the next visit the stored text is automatically displayed in the text field and can be edited. I am trying to keep it simple but php would be an option.

How could this be achieved?

<´¯`·.¸ Patric ¸.·´¯`>

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 10-01-2003 12:15

You want to use the php->fopen() function to read the contents of your file into a variable, then when you generate the code for your text box, simply add into it's tag value="$file" (or whatever you named your file variable. When the form is then submitted you pull that data back out of the $_POST array and using fopen() to truncate the file to 0 bytes and write the contents of your text field into it. The other functions your going to need are:

php->fread()
php->fwrite()
php->fclose()

Anyway...the PHP manual has all the info you'll need to do this, but if you have any problems don't hesitate to ask more questions about it.

patric design
Bipolar (III) Inmate

From: 290 km/h, fast lane, Autobahn, Germany
Insane since: Feb 2001

posted posted 10-01-2003 15:02

thanx Skaarjj

that left a whole lot of $s and ()s in my head. I haven't coded for a few months now and I feel like I've to lear how to walk again. looks like i need to re-gain some php skills before I tend to this. you wouldn't happen to know where I could find some sample code to this?

<´¯`·.¸ Patric ¸.·´¯`>

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 10-01-2003 15:42

http://www.hotscripts.com/PHP/Tips_and_Tutorials/File_Manipulation/index.html would be a good place to start

« BackwardsOnwards »

Show Forum Drop Down Menu