Category List and Details Pages

You've seen a few different examples of how to not only retreive data from the database and display it on a web page, but also to create HTML forms that allow inserting and updating rows in the database.

In this step you'll create pages that allow authenticated users to add and edit categories of blog posts. We created the 'categories' table back when we first set up the database for this project. Now you will build a few web pages that will allow users to add and edit new categories of blog posts.

In theory, this step should be quite straight forward, albeit a bit tedious. You'll be following the same algorithm that you've seen with the blog and file pages in the control panel. If you can get through this step, you can adapt it to many situations when building a dynamic website. In my career I've used this algorithm countless times. So many times, that at one point I even wrote a script that allowed me to enter the column names (and data types) for a table, and it would generate all the PHP code for me!

Create a Category List Page

Create a page that lists all the rows from the categories table, it will look like this.

Add Methods to the CategoryDataAccess Class

Create a Category Details Page

We'll create a page that looks like this.