Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Learning PHP, Part 1: Register for an account, upload files for approval, and view and download approved files

Nicholas Chase, Founder, NoTooMi
Nicholas Chase is the founder and creator of NoTooMi. In addition to technical writing for large corporations, he has been involved in website development for companies such as Lucent Technologies, Sun Microsystems, Oracle, and the Tampa Bay Buccaneers. He has been a high school physics teacher, a low-level-radioactive waste facility manager, an online science fiction magazine editor, a multimedia engineer, an Oracle instructor, and the chief technology officer of an interactive communications company. He is the author of several books, including XML Primer Plus (Sams 2002).

Summary:  This tutorial is Part 1 of a three-part "Learning PHP" series teaching you how to use PHP through building a simple workflow application. This tutorial walks you through creating a basic PHP page using HTML forms and covers accessing databases.

23 Oct 2012 - Nicholas Chase updated content throughout this tutorial to reflect current PHP technology.

View more content in this series

Date:  23 Oct 2012 (Published 14 Jun 2005)
Level:  Intermediate PDF:  A4 and Letter (948 KB | 38 pages)Get Adobe® Reader®

Activity:  85192 views
Comments:  

Before you start

In this first part of the series you will learn about basic PHP syntax, forms and functions and how to connect to and use MySQL or any other database with your PHP application.

About this tutorial

This tutorial walks you through building a simple workflow application with PHP. Users will register for an account, upload files for approval, and view and download approved files. Users designated as administrators can view uploaded files and approve them to make the files available to all users. Part 2 and Part 3 of this series explore HTTP password protection, XML, JSON, and other relevant issues.

This tutorial covers the following:

  • Creating a basic page
  • Variables, loops, and if-then statements
  • Functions
  • Connecting to a database
  • Using include files
  • Tools

Who should take this tutorial?

If you're a programmer who wants to learn how to use PHP to build web-based applications, start here with Part 1 of a three-part series of tutorials. PHP is a script-based language that is easy to learn, but still enables you to build complex applications with robust functionality. This tutorial walks you through creating a basic PHP page using HTML forms. It also explains how to access a database.


Prerequisites

This tutorial assumes you have no PHP experience. In fact, while it's useful for you to be familiar with the concepts of HTML, no other programming is necessary for this tutorial. Feel free to download the source code used in this tutorial.


System requirements

You need to have a web server, PHP, and a database installed and available. If you have a hosting account, you can use it as long as the server has PHP V5 installed and has access to a MySQL database. Otherwise, download and install the following packages:

XAMPP
Whether you're on Windows®, Linux®, or even Mac, the easiest way to get all of the necessary pieces of software for this tutorial is to install XAMPP, which includes a web server, PHP, and the MySQL database engine. If you choose to go this route, simply install, then run the control panel to start up the Apache and MySQL processes. You also have the option of installing the various pieces separately, but keep in mind you will then have to configure them to work together—a step which is already taken care of by XAMPP.
Web server
If you choose not to use XAMPP, you have several options for a web server. If you're using PHP 5.4 (as of this writing, XAMPP is only using PHP 5.3.8) you can use the built-in web server for testing. For production, however, I will going to assume that you're using the Apache Web server, version 2.x.
PHP 5.x
If you're not using XAMPP, you will need to download PHP 5.x separately. The standard distribution includes everything you're going to need for this tutorial. Feel free to download the binaries; you will not need the source for this tutorial (or ever, unless you want to hack on PHP itself). This tutorial was written and tested on PHP 5.3.8.
MySQL
Part of this project involves saving data to a database, so you'll need one of those, as well. Again, if you've installed XAMPP, you can skip this step, but if you choose to, you can install a database separately. In this tutorial, I'll concentrate on MySQL because it's so commonly used with PHP, so if you choose to go this route, you can download and install the Community Server.

1 of 10 | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Open source, Linux
ArticleID=133648
TutorialTitle=Learning PHP, Part 1: Register for an account, upload files for approval, and view and download approved files
publish-date=10232012
author1-email=ibmquestions@nicholaschase.com
author1-email-cc=