Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
PHP - saving a file
Name: rhawkes241 Date: September 18, 2005 at 03:10:57 Pacific OS: Windows xp CPU/Ram: Athlon XP 1700, 512SD
Comment:
Hi,
How would you create a basic php sctript to save a value entered on a website into a plain text file on the server?
For instance, if a user enters "1" into a text box and submits the value, how can a text file be saved with the value of "1"?
I'm new to PHP and just starting out, but its something which I'd like to know for developing a small application as im learning.
By the way, using files to save/retrieve information is very inneficient and can be easily corrupted. I suggest you look into using a database ont he back-end.
0
Response Number 2
Name: FBI Agent Date: September 19, 2005 at 06:49:21 Pacific
you just read on how to open it then down at the bottom before "user contributed notes" there's fread and fwrite, check into those. also, dont forget to fclose your file after you're done with it.
Michael J would also be correct on what he's saying, however, i already know that you're making a counter of your webpages so that should be just fine using a flat file, but when ou want to start saving some big things in files, start looking towards a database, they're really not all that complicated at all, just get PHPMyAdmin and it's a snap
Name: rhawkes241 Date: September 19, 2005 at 15:50:42 Pacific
Reply:
Alright many thanks for your responses - I'll be looking into it further now I have a better idea of what to look for - the fread and fwrite seem pretty simple.
0
Response Number 4
Name: thtjen Date: September 28, 2005 at 00:50:52 Pacific
Reply:
since you guys are on this topic, could you tell me how can i extract the text box data from one page to another?! i tried saving the text in the textbox in an array on the first website like so:<textarea name="Text[t]" cols="70" rows="30"></textarea>// and calling the array name Text[] on another page but nothing comes out. could i call a variable (array) that i stored on a previous webpage to another webpage?! please help. Thanks. btw, i tried the link but nothing comes out.
0
Response Number 5
Name: thtjen Date: September 28, 2005 at 00:54:15 Pacific
Reply:
with the "t" included in the "Text[t]" when calling
Summary: I'm trying to learn php for a task at work. What i need to do is pretty much create an employee inventory form that hold certain information about an employee (their name, phone, email, OS, and MAC a...
Summary: ok, i need a php script that will copy all of the content of one file so i can paste it into another file. $stuff = "script" kinda like that. i just need the script that will copy from a file...
Summary: Hi there PHP geniuses. I've just set up a test MySQL database and have written php pages to upload to it, read the contents of it, edit the contents of it and download files from it. All these pages a...