LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Creating a simple html page from php? (https://www.linuxquestions.org/questions/linux-general-1/creating-a-simple-html-page-from-php-112525/)

lucastic 11-05-2003 12:01 AM

Creating a simple html page from php?
 
Hello All,

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?

Thanks in advance

Lucas

Bluesuperman 11-05-2003 12:27 AM

Your post is to vague -- you need more information.

For example - if you told me that you have a postgres db or a mysql db with all this information in it then I would say:

using php - write a script that connects to the database, then write a recursive function to lookup data in the db and print it to a html form.

From your post all I know is that you have lots of information you want posted.

Where is this information kept ? DB , file ....
How much do you want displayed at a time -- you need some sort if "sorting" function

lucastic 11-05-2003 12:46 AM

Thanks for the reply!

Sorry to be so Vague to clarify:

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?

Thanks Lucas

usernamenumber 11-05-2003 07:09 AM

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:

http://www.php.net/manual/en/function.fwrite.php

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.

Hope this helps!
--Brad

lucastic 11-05-2003 08:48 AM

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.

Thanks again!

Long live the penguin!!


All times are GMT -5. The time now is 07:03 PM.