Computing.Net > Forums > Web Development > Saving a form to a php 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.

Saving a form to a php file

Reply to Message Icon

Name: brds
Date: March 9, 2007 at 04:35:12 Pacific
OS: Windows XP
CPU/Ram: 512
Product: Dell
Comment:

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 address). I would like to have a form to create this. My question is, is there a way to have a form write and save the newly entered information into a file without erasing anything that was there previously. If so, could somebody please help me out?

Thanks,
brds



Sponsored Link
Ads by Google

Response Number 1
Name: Michael J (by mjdamato)
Date: March 9, 2007 at 08:28:26 Pacific
Reply:

Yes, but it is not without some potential problems. Using a flat file for data such as this should not be done with caution. If two people were trying to write tot he file at the same time you could corrupt all the data. There are performance issues as well.

Writing the information to the file is not difficult. Just open the file and write the new information to it using some sort of delimination, i.e. comma or tab delimited. The more difficult part is accessing the data. If you were looking for a particulaqr record you need to read through the lines in the file until you found the one you wanted and then parse out the data.

Having said all that, I always prefer to use a MySQL database. The learning curve may be a little more steep than using a flat file, but you can do so much more. However, if you want to use a flat file, here is a tutorial on how to read the data: http://www.designdetector.com/archi...

here is another on how to write to a file: http://www.tizag.com/phpT/filewrite...

Of course, editing a line in the file is a little tricker, but not impossible.

Another option is to use this API which allos you to utilize a text file just like a database: http://www.c-worker.ch/txtdbapi/ind...

Michael J


0
Reply to Message Icon

Related Posts

See More


trim characters from php ... Looking for Random Text G...



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: Saving a form to a php file

Is there a php / mySQL editor? www.computing.net/answers/webdevel/is-there-a-php-mysql-editor/3335.html

error - php file to download pdf. www.computing.net/answers/webdevel/error-php-file-to-download-pdf/3828.html

PHP File Downloader? www.computing.net/answers/webdevel/php-file-downloader/1934.html