Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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

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.

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

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.

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.

![]() |
![]() |
![]() |

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