Before you start
This tutorial teaches you how to use PHP by demonstrating the construction of a Web-based workflow application. "Learning PHP, Part 1" covered the basics, such as syntax, functions, working with HTML forms submissions and databases, and creating a process by which a new user can register for an account.
In this tutorial, you're going to enable users to upload files to the system by using their browsers, and you're going to use XML to store and display information about each file.
Part 3 looks at using HTTP authentication, as well as protecting files by streaming them from a non-Web-accessible directory. You'll also look at creating objects and using exceptions.
In the course of this tutorial, you'll examine:
- Creating and using sessions and session information.
- Uploading files from the browser.
- Creating XML using the Document Object Model (DOM).
- Manipulating XML data using DOM.
- Creating a Simple API for XML (SAX) content handler.
- Reading XML data using SAX.
Who should take this tutorial?
This tutorial is Part 2 in a three-part series designed to teach you the various aspects of working with PHP while building a workflow application. Take this tutorial if you have a basic understanding of PHP and want to learn about uploading files from the browser, sessions, or using PHP to process XML.
This tutorial assumes a basic familiarity with PHP to the level discussed in Part 1 of this series. That includes basic understanding of control structures, such as loops and if-then statements, as well as functions, and working with HTML forms submissions and databases. Familiarity with XML is helpful, but not required. (You can find more information about these topics in Resources.)
To follow along, you need a Web server, PHP, and a database installed and available. Unless you will be using an external hosting account, download and install the following packages:
Web server -- Whether you're on Windows® or Linux® (or Mac OS X, for that matter), you have the option of using the Apache Web server. Feel free to choose V1.3 or V2.0, but the instructions in this tutorial will concentrate on 2.0. Download Apache. If you're on Windows, you also can use Internet Information Services, which is part of Windows.
PHP -- Of course, you will also need a distribution of PHP. Both PHP V4 and PHP V5 are in use at the time of this writing, but because of changes in PHP V5, we'll concentrate on that version. (The version isn't terribly important in this tutorial, but it makes a difference for the last part of this series.) Download PHP.
Database -- Part of this project involves saving data to a database, so you'll need one of those, as well. In this tutorial, we'll concentrate on MySQL because it's so commonly used with PHP. Download MySQL.

