CSIS 2440 – Server-side PHP Salt Lake Community College · coursework 2022–23

Exercises from my server-side programming class, where I learned PHP: building pages on the server, validating forms, reading files and writing object-oriented code. Each one is kept as I built it.

PHP 8 OOP Forms & regex 10 exercises

PHP basics & forms

Pages generated on the server, and form input checked with regular expressions.

Screenshot of Birthday Card

Birthday Card

PHP

A first PHP page: the birthday card's heading and picture are written out with PHP echo statements.

Screenshot of Contact Form Validation

Contact Form Validation

PHPRegexForms

A contact form checked on the server with regular expressions (names, 10-digit phone, email, 5-digit ZIP). Mistakes are flagged next to the field with your entries kept; valid input shows a confirmation screen.

Screenshot of Top 10 Albums by Genre

Top 10 Albums by Genre

PHPFile I/O

Reads album lists from text files, shuffles them and builds a table of rock albums with a random YouTube video. A button switches to pop albums and a different video.

Object-oriented PHP

Classes, constructors, getters and setters, inheritance and exceptions.

Screenshot of OOP Day 1 – Dog class

OOP Day 1 – Dog class

PHPOOP

A Dog class with a constructor, getters and setters, a check that age is a positive number, and a __toString() method that prints each dog's details.

Inheritance

OOP Day 2 – Animal inheritance

PHPOOP

An Animal base class with Dog and Bird subclasses that override talk() and move(). Bird adds a wingspan, and invalid numbers throw exceptions.

Screenshot of Build Your Own Robot

Build Your Own Robot

PHPOOPForms

Pick a size, model, operating system, colour and any of Asimov's three laws. The order is checked on the server, then built as a PHP Robots object that shows the robot's picture and laws.

JavaScript in the browser

Client-side work from the same class: canvas animation, keyboard control and event listeners.

Screenshot of Bouncing Balls

Bouncing Balls

JavaScriptCanvas

30 randomly sized and coloured balls bounce around a full-window HTML canvas, drawn with requestAnimationFrame and a Ball object.

Screenshot of Karel the Robot

Karel the Robot

PHPJavaScript

PHP builds a 10×10 grid. Use the arrow keys to turn the robot, Space to move, Enter to drop or pick up a beeper (three to start) and Esc to reset.

Keyup events

Live Phone & Email Check

JavaScriptRegex

keyup event listeners test a phone number and an email address against regular expressions and say whether each is valid as you type.

Input events

Password Match

JavaScriptForms

The submit button stays disabled until the password and confirm-password fields match, with a live message that updates on every keystroke.

Database-backed exercises from this class (the poll, palindromes, product catalogue, log-ins and sessions) aren't linked because the database they used has been retired. A few unfinished practice pages are also left out.