Specifications

Using PHP
In order to work through the examples in this chapter and the rest of the book, you will need
access to a Web server with PHP installed. To get the most from the examples and case studies,
you should run them and try changing them. To do this, youll need a testbed where you can
experiment.
If PHP is not installed on your machine, you will need to begin by installing it, or getting your
system administrator to install it for you. You can find instructions for doing so in Appendix A,
Installing PHP 4 and MySQL. Everything you need to install PHP under UNIX or Windows
NT can be found on the accompanying CD-ROM.
Sample Application: Bobs Auto Parts
One of the most common applications of any server side scripting language is processing
HTML forms. Youll start learning PHP by implementing an order form for Bobs Auto Parts,
a fictional spare parts company. All the code for the Bobs examples used in this chapter is in
the directory called chapter1 on the CD-ROM.
The Order Form
Right now, Bobs HTML programmer has gotten as far as setting up an order form for the
parts that Bob sells. The order form is shown in Figure 1.1. This is a relatively simple order
form, similar to many you have probably seen while surfing. The first thing Bob would like to
be able to do is know what his customer ordered, work out the total of the customers order,
and how much sales tax is payable on the order.
PHP Crash Course
C
HAPTER 1
1
PHP CRASH
COURSE
11
FIGURE 1.1
Bob’s initial order form only records products and quantities.
03 7842 CH01 3/6/01 3:39 PM Page 11