TWD :: PHP PROJECT 01
OBJECTIVE Use PHP and MySQL to create a database table administration interface. A sample of this
assignment is available at:
https://bcitcomp.ca/twd/php_project/
REQUIREMENTS You may complete this assignment with a partner or on your own.
You will write a web application that allows a user to administer the students table on the bcit
database. The user will need to be able to view the current state of the table, as well as add,
delete or edit a record.
Write a PHP page that displays the entire students table as an HTML table, one record per row.
Include an “Add Student” link somewhere near the table. Include two additional data cells per
row, one containing a “Delete” and the other a “Update” link. The screenshot below shows an
example of how it might look:
The Update and Delete links should send record-specific information via a
$_GET query string to the script(s) responsible for updating and deleting from
the database (see the shared FTP server for an example of using the query
string).
MORE on next page…
Page | 2 jethro
Functional Features
Write script(s) for handling each operation:
– Add Student: Display a form with inputs for Student Number, First and Last
names, and a Submit button.
– Delete: Display the record information of the record they chose to delete.
Give them one last chance to change their mind, eg: ask the user if they are
sure they want to delete the record, and display a form with a radio button
option of ‘yes’ and ‘no’.
– Update: Display a form with fields for Student Number, First and Last names.
Pre-populate these fields with the current record data. Add a Submit button.
Regardless of the database operation performed, after executing the SQL
query, be sure to forward the user back to the page that displays all table data,
so that they can see the latest table status.
Usability Features
Provide feedback to the user as they interact with your scripts. Display positive
feedback, such as: “A new record has been added to the table” and also error
messages, eg: “The record could not be updated as requested.”
Security Features
Thoroughly validate all form data. Protect against SQL injection attacks.
HINTS – Build your scripts slowly and test thoroughly as you go. Try to break the
problem down into smaller parts, and solve each part before proceeding to
the next. For example, first deal with displaying the student records in a table,
after completing that functionality, deal with one of the operations, eg: ‘Add a
student’ and complete that before dealing with the ‘Delete’ or ‘Update’
features.
– A $_GET query string is the only way to identify which link in a series of links
may have been clicked to make the most recent request. It requires adding the
query string to the href, eg:
<a href=’page.php?link=one’>link one</a>
<a href=’page.php?link=two’>link two</a>
Page | 3 jethro
– Use sessions wherever possible to remember important data across multiple
pages.
SUBMISSION Before the end of day Dec 20, compress file(s) into a .zip or .rar file named
php_project_lastname_firstname.zip
using your last and first name. Upload the compressed file to the FTP Dropbox.
If completed with a partner, include both names in the file, eg:
php_project_lastname01_firstname01_lastname02_firstname02.zip