How can I display form input on html pages?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lexblago
Forum Newbie
Posts: 5
Joined: Thu Jun 05, 2008 8:56 am

How can I display form input on html pages?

Post 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.
nowaydown1
Forum Contributor
Posts: 169
Joined: Sun Apr 27, 2008 1:22 am

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

Post 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.
User avatar
[UW] Jake
Forum Commoner
Posts: 25
Joined: Sun Jun 01, 2008 9:04 pm
Location: USA

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

Post 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.
lexblago
Forum Newbie
Posts: 5
Joined: Thu Jun 05, 2008 8:56 am

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

Post 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.
User avatar
[UW] Jake
Forum Commoner
Posts: 25
Joined: Sun Jun 01, 2008 9:04 pm
Location: USA

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

Post 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)
lexblago
Forum Newbie
Posts: 5
Joined: Thu Jun 05, 2008 8:56 am

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

Post 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.
Post Reply