Page 1 of 1

variables and forms

Posted: Sat Jan 24, 2004 11:40 pm
by John Cartwright
I'm somewhat new in php and I was wondering if someone could point me in the right direction about this. I am setting up a bunch of forms which allow an administrator to change certain contents of the site, for example:

A news page
or a Releases page

How could you allow forms to call up the data and then be able to modify it. Another thing is, using the news page as an example, when you create a new news article, the past news is shuved down the list, so when viewing the news page your articles r from newest to oldest.

That should be more than enough to get it started, althought this is going to grow into a somewhat bigger project. Could someone please show me a tutorial on this kind of thing, and recommend if using a database is appropriate ( obviously it is ) but if there is a better way to do it.

TY ALOT! :D

Posted: Sun Jan 25, 2004 12:04 am
by microthick
Using a database is the right idea.

You'd have a database table that contained everything about the different news articles. For example:

Table Name: news
Database Fields: id, title, body, date, author, authorEmail

Then your form would populate those database fields with the form content.

When you output the news articles you can basically say (using SQL), "Get me the 5 most recent articles, ordered by date."

Anyway, here's a quick tutorial from Zend that introduces you to using databases and PHP together.

http://www.zend.com/zend/tut/tutorial-yank.php

It uses Jokes rather than News as the example, but you'll get the idea.

Posted: Sun Jan 25, 2004 9:40 am
by John Cartwright
Thanks alot... I'll be back when I got more questions,

but my other part of my post how do I get forms to change the information in the database