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.
Watch the Trailer
7 badges • 43 videos
-
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.
-
Creating the Menu and Footer
Our product catalog website will have a number of pages, but the pages share a few common elements like the top navigation menu and the footer. We’ll build these shared elements into a set of template files, using basic programming concepts like variables and conditionals to make it all work.
-
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
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
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.
-
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.
-
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.