Skip to content
Examination case 02

Enrollment Information System

Tracks who is enrolled in which course, every semester, with a status you can trust.

  • PHP
  • MySQL
  • PDO
  • HTML5
  • XAMPP
  • phpMyAdmin

Project overview

The Enrollment Information System records each student's enrollment in a course for a given semester. Registrar staff can add enrollments, review them in one list, update details and remove records entered by mistake. Every enrollment carries a status that can only ever be Enrolled or Dropped.

Problem it solves

When enrollments are tracked on paper or in loose spreadsheets, statuses drift into inconsistent spellings and dropped students quietly disappear from the records, which makes class lists and reports unreliable.

Key features

  • Add, list, view, edit and delete enrollment records
  • Student number, student name, course, semester and status on every record
  • Status limited to exactly Enrolled or Dropped, by a dropdown and a server-side check
  • Dropping a student is a status change, so the enrollment history is kept
  • A confirmation page before a record is permanently deleted

Case-specific rule

Status must be exactly Enrolled or Dropped

The value is checked against a fixed list on the server with a strict comparison, so a modified form cannot save any other status. Marking a student as Dropped keeps the record.

Database design

Database enrollment_db, table enrollments, InnoDB with utf8mb4.

Columns of the enrollments table
ColumnTypeRule
idINT AUTO_INCREMENTPrimary key, generated automatically.
student_numberVARCHAR(30)Required. Up to 30 characters.
student_nameVARCHAR(100)Required. Up to 100 characters.
course_nameVARCHAR(100)Required. Up to 100 characters.
semesterVARCHAR(50)Required. Up to 50 characters.
statusVARCHAR(20)Required. Exactly one of: Enrolled, Dropped.

From the code

The validation behind this case, exactly as written in create.php.

enrollment-system/create.php
if ($values['status'] === '') $errors[] = 'Enrollment Status is required.';
if (!in_array($values['status'], ['Enrolled', 'Dropped'], true)) {
    $errors[] = 'Choose a valid status: Enrolled or Dropped.';
}

Challenges and solutions

01

One status, two allowed values

Challenge encountered

A dropdown alone cannot stop a modified request from submitting a status like Pending, or enrolled in the wrong case.

Solution implemented

The server compares the submitted status against Enrolled and Dropped with in_array in strict mode, and refuses anything else with a clear message.

02

Dropping without losing history

Challenge encountered

Students who drop a course still belong in the enrollment history for reports and audits.

Solution implemented

Dropping is a status, not a deletion. Deleting stays a separate, confirmed action reserved for records entered by mistake.

Outcome and impact

Reliable enrollment records with consistent statuses, delivered as a ready-to-import project with three sample enrollments.

Every PHP file in the project passed syntax checking before submission.

Files delivered
8
PHP pages
6
Table columns
6
Sample records
3

Project files

Delivered in the required eight-file format, ready to drop into XAMPP.

  • config.phpOpens the PDO connection to the database, with exceptions turned on for errors.
  • index.phpLists every record, newest first, with View, Edit and Delete links on each row.
  • create.phpValidates a new record, saves it with a prepared INSERT, then redirects to the list.
  • view.phpShows one record after checking that its ID is a positive whole number.
  • edit.phpLoads an existing record, validates the changes and saves them with a prepared UPDATE.
  • delete.phpShows a confirmation page, then deletes the record only on a confirmed POST.
  • database.sqlCreates the database and table, then inserts three fictional sample records.
  • README.mdSetup steps for XAMPP and phpMyAdmin, plus the feature list and local URL.

Secure by default

The same six practices protect all five examination cases.

  • Prepared statementsEvery query runs through PDO prepared statements with named placeholders, so typed input never becomes part of the SQL.
  • Escaped outputEvery value passes through htmlspecialchars with ENT_QUOTES and UTF-8 before it reaches the page, which blocks script injection.
  • POST-only changesCreating, editing and deleting only happen on POST requests, and a delete needs an explicit confirmation first.
  • Safe record IDsIDs must be positive whole numbers. A missing or invalid record returns a 404 with a clear Record not found page.
  • Post, redirect, getAfter a successful save the page redirects to the list, so refreshing the browser never submits the form twice.
  • Helpful validationFailed saves list every problem at once and keep what was typed, so nobody has to fill in the form again.

See it working

Add, edit and delete records in the live demo, and watch each prepared statement as it runs.

Open live demo