Build a Simple PHP Application

This project will show you how to build an e-commerce store in the PHP programming language. By the end, you'll be able to build an online t-shirt store that can display inventory items and take orders via PayPal.

Build a Simple PHP Application

7 Achievements

Getting Started with PHP

Getting Started with PHP

The browser can understand HTML and CSS all by itself, but we’ll need a little bit more sophisticated setup to handle PHP. We’ll get familiar with what PHP code looks like and where it can run, exploring the differences between a client-side language and a server-side language. We’ll walk step by step through installing everything you’ll need to run PHP code, and we’ll end with a simple but functioning PHP script.

Adding a Contact Form

Adding a Contact Form

PHP does more than just make a set of HTML files easier to maintain. It also adds advanced functionality to a site that HTML and CSS alone cannot achieve, like sending an email. We’ll create a contact form for our website, allowing users to enter a message into an HTML form and then using PHP to process the form submission.

Listing Inventory Items

Listing Inventory Items

Our product catalog contains quite a bit of information, too much to fit in simple variables. A PHP array will be perfect for the task, and we’ll explore all the ins and outs of working with arrays to store sets of related data. We’ll also use the data from the array to populate our main Shirts page that shows a list of all the products in our catalog.

Integrating With Paypal

Integrating with PayPal

Each shirt in our catalog has its own individual page, and we’ll build out a new template for all of those pages that integrates with Paypal. PayPal offers services that provide an easy way to handle a shopping cart and payments. We’ll walk through the steps of setting up a new PayPal account. We’ll cover how to customize the cart and checkout pages, and we’ll get the form code necessary to integrate the Add to Cart buttons into our store.

0 of 11 Steps Complete
Working with PHP Functions

Working With Functions

The home page of our website displays a small subset of the products, but the layout should be the same as the Shirts Listing page. We’ll work with PHP functions, blocks of code that can be called from other blocks of code, to make sure that products are displayed the same across all list pages. PHP comes with a large number of native functions, but it also provides a way to create our own.

0 of 7 Steps Complete
Simple PHP Application: Wrapping Up The Project

Wrapping Up The Project

We have a few items left to wrap up the project, tightening the integration with PayPal and sending the email from our contact form. We’ll discuss how to deploy the site, objects in PHP, and third-party libraries. At the end of this stage, we’ll have a fully-functional ecommerce website.


Download videos

You need to sign up for Treehouse in order to download course videos.

Sign up