Computing.Net > Forums > Web Development > PHP - saving a file

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

Reply to Message Icon

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.

Thanks in advance



Sponsored Link
Ads by Google

Response Number 1
Name: Michael J (by mjdamato)
Date: September 18, 2005 at 10:48:58 Pacific
Reply:

PHP File System Functions

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
Reply:

i would suggest using this part of the site

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

FBI Agent

AIM: EliteAssassin187


0

Response Number 3
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


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: PHP - saving a file

Saving a form to a php file www.computing.net/answers/webdevel/saving-a-form-to-a-php-file/3154.html

php copy from file script www.computing.net/answers/webdevel/php-copy-from-file-script/392.html

Downloading a file from mysql www.computing.net/answers/webdevel/downloading-a-file-from-mysql/2373.html