CS 315 Homework 5: PHP & Databases

Assigned: 9 November 2009   Due: 20 November 2009

This homework problem is to be done individually, not in pairs or other groups. Your completed assignment should be submitted using the Assignment Submission Page. You should submit (in one submission) both the URLs of the actual PHP files that run and the URLs of the .phps files with your source.

  1. Define a simple SQL database table with three or four columns of your choosing. For example, you might have LastName, FirstName and EmailAddress or something equally simple. Include the definition of your table as a comment in some obvious part of the assignment that you submit.
  2. Write a program using a single PHP file that presents the user with a form that allows them to enter whatever kind of data you want to store in your table, then, when they click Submit, processes the form, does a thorough security check and cleansing of the data the user gives you, then (when the data is reasonable) inserts the data into your database.
  3. Write another program using a single PHP file that presents the contents of your database in some appropriate manner. By appropriate manner I mean that your data should be presented in a way that makes sense. Be sure to present all of the data. You will almost definitely want to sort your data by some relevant field. HTML tables might (or might not) be a good way to present the data.
  • All of your code should be contained in the two .php files. Of course, be sure to have .phps files as well.