Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I run a small web server from home. I have decided to use Oscommerce as my webshop... Seems excellent.
However I need a way of being able to have a very simple form, if possible auto dated in one field, with three additional input fields for text and numbers. This would be used for cataloging the stock location of each item. (I sell radio valves so there are 1000s of items). I need this information to be entered into a simple html file, the output of which would look something like this:
20/10/03: Data field 1 Data field 2 Data field 3
and so on.
Two reasons for wanting to do it like this... One so I can find the item location, from any home pc I may be on. Two, so I can input information from anywhere.
I have googled but get an information overload of everything but what I am specifically looking for.
Can anyone help... point me in the right direction?
The server is Redhat 9, running Apache, PHP and mysql.
I suppose the question is; what is the best way to do this?
I wanted the "data" or list stored on the html file, because it seemed simple. Form input goes to itemstorelocation.html, when I want to check where a stock item is I open the page from my browser on any pc and do a text search...
I need to be able to text search the whole file when viewing itemstorelocation.html at once. The enties going into and being dispayed from the file only need to be ordered in the order they were added.
Given the extra information would it be better to do this using the above method or the method Bluesuperman suggested, using a php script to, say, mysql database, then back to html?
Distribution: Fedora/RHEL currently. Red Hat, Slackware, Debian, SuSe and Mandrake at other times
Posts: 104
Rep:
I don't know if it would be wise to just dump things into a text file or not. Yes, it will be simple to search and require less coding on your part. But on the other hand if you store everything in a database you will have many more options for how to manage the data in the future. For example, you would be able to write a form that only displayed items of a certain property. If you have 1000s of items I imagine this would be useful.
Using a plain file will have no affect on which machines can see the data since the database and all of the code the manages the db is server-side. Once you get the server set up, anyone with a web browser should be able to use the interface and view the data.
The big advantage to using a simple file for output is that if you are a novice php coder it will be much simpler. Just check out the entry for fwrite() in the php.net manual:
That manual, by the way, is just about the only reference you'll need when getting started with php. If you get ambitious, check out the mysql functions as well.
And you can always write the app to store data in a text file for now and then write something to convert the text file into mysql tables when you feel ready to start using a database backend.
Thanks Brad, that was exactly the answer I was looking for, with a link for further learning.
I agree, the more I think about it the more it makes sense to store the data in a database instead of a text file, in case I do want to sort it differently in the future.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.