Page 1 of 1

How can I display form input on html pages?

Posted: Thu Jun 05, 2008 9:09 am
by lexblago
I'm trying to create a "simple" content management/update system for the admin. Here's the theory behind it: Admin logs in with username and password. The login page contains forms that are titled in accordance with where they will be placed on the public html pages. The admin fills in the forms and after hitting submit, the information submitted gets plugged into the website.

Here's my question: What is the easiest possible way to do this? I was thinking I could have the admin forms pass the information into individual text files which can then be included into the html with a simple include("file.txt"); statement. Would this even work?

Any thoughts are very much appreciated.

Re: How can I display form input on html pages?

Posted: Thu Jun 05, 2008 9:26 am
by nowaydown1
In theory, you could probably do that, but I wouldn't. I would look at using a database to store your dynamic data. Even if you didn't want to go to the trouble of dealing with MySQL directly, you can investigate using something like SQLite.

Re: How can I display form input on html pages?

Posted: Thu Jun 05, 2008 12:57 pm
by [UW] Jake
I would definitely use MySQL. In my opinion it's a more efficient & secure way to achieve what you want. It also will take less time to code in the long run. Just make yourself a framework for what your site is doing. When I use MySQL, I create a db.php file with my user/pass/host/db name and I create functions such as DB_OPEN, CREATE_ACCOUNT, DB_CLOSE, and others to streamline the process.

Re: How can I display form input on html pages?

Posted: Thu Jun 05, 2008 4:36 pm
by lexblago
Thanks for the suggestions, I really do appreciate em. The only reason I didn't want to use a database initially is because the information stored isn't sensitive information. But, I'll go ahead and use the database anyway.

Any suggestions as to where to start? I'm still pretty new to MySql. My ultimate goal is to make this as simple as possible.

So, I'm assuming things will work as follows:

1. You have the original html pages.
2. You then have your separate .php page where the admin inputs information.
3. Upon clicking submit the information in the forms are stored as data in the database.
4. The original html pages then call information from the database.

Are there any good tutorials for how to set this up?

Thanks a million.

Re: How can I display form input on html pages?

Posted: Thu Jun 05, 2008 4:57 pm
by [UW] Jake
Read about mysql queries:

Here are the queries you would probably use
"CREATE DATABASE" (usually only once in a file such as setup.php)
"CREATE TABLE" (usually only once in a file such as setup.php, for example, create table users, create table pages, etc)
"INSERT" (for adding new rows)
"UPDATE" (for existing rows)
"SELECT" (for reading from rows)
"DELETE" (to delete a row)

Re: How can I display form input on html pages?

Posted: Sun Jun 08, 2008 6:57 am
by lexblago
Thanks, I've been building this and its pretty time consuming considering I've got to learn it as it go. But it's all good. Trial and error is a pain in the ass! :)

Would it be easier to maybe use an open source php/mysql content management script?
If so, any suggestions?

Thanks again.