JavaScript Editor Javascript validator     Website design 

Team LiB
Previous Section Next Section

List of Figures

Chapter 1: Exploring the PHP Environment

Figure 1.1: The tip of the day might look simple, but it is a technological marvel, because it features html, cascading style sheets, and PHP code.
Figure 1.2: A very basic Web page.
Figure 1.3: An HTML page containing the most common HTML tags.
Figure 1.4: Examples of several other basic HTML tags.
Figure 1.5: Tables can be basic, or cells can occupy multiple rows and columns.
Figure 1.6: I used CSS to define the special styles shown on this page.
Figure 1.7: The H1 style has been defined for the entire page, as well as two kinds of paragraph styles.
Figure 1.8: External style sheets look just like other styles to the user, but they have advantages for the programmer.
Figure 1.9: You can add text boxes, text areas, password boxes, and hidden fields (which do not appear to the user) to your Web pages.
Figure 1.10: Several HTML elements allow the user to enter information without having to type anything.
Figure 1.11: Although these buttons all look very similar to the user, they are different, and have distinctive behaviors.
Figure 1.12: The page mixes HTML with some other things.

Chapter 2: Using Variables and Input

Figure 2.1: The program begins by asking the user to enter some information.
Figure 2.2: I hate it when the warthog's in the kohlrabi.
Figure 2.3: The word "Jacob" is stored in a variable in this page. You can't really see anything special about this program from the Web page itself (even if you look at the HTML source). To see what's new, look at the source code of hiJacob.php.
Figure 2.4: This error will occur if you forget to add a semicolon to the end of every line.
Figure 2.5: This program shows the words to a popular song. They sure repeat a lot.
Figure 2.6: This program does basic math on variables containing the values 3 and 5.
Figure 2.7: This is an ordinary HTML page containing a form.
Figure 2.8: The resulting page uses the value from the original HTML form.
Figure 2.9: The links on this page appear ordinary, but they are unusually powerful.
Figure 2.10: When I clicked on the "Hi Elizabeth" link, I was taken to the HiUser program with the value "Elizabeth" automatically sent to the program!
Figure 2.11: The Google PHP runs a search on for the term "PHP".
Figure 2.12: The Google search for "Absolute Beginners Programming" shows some really intriguing book offerings!
Figure 2.13: The borderMaker HTML page uses a text area, two list boxes, and a select group.
Figure 2.14: The borderMaker.php code reacts to all the various input elements on the form.
Figure 2.15: My plan for the story game. I thought through the story and the word list before writing any code.

Chapter 3: Controlling Your Code with Conditions and Functions

Figure 3.1: This is a new twist on an old dice puzzle.
Figure 3.2: The die roll is randomly generated by PHP.
Figure 3.3: When the roll is not a one, nothing interesting happens.
Figure 3.4: When a one appears, the user is treated to a lavish multimedia display.
Figure 3.5: If the program rolls a "one," it still hollers out "Ace!"
Figure 3.6: If the program rolls anything but a one, it still has a message for the user.
Figure 3.7: The roll is a 5, and the program shows the binary representation of that value.
Figure 3.8: After rolling again, the program again reports the binary representation of the new roll.
Figure 3.9: This version shows a die roll in Roman numerals.
Figure 3.10: The HTML page is actually produced through PHP code.
Figure 3.11: The result is produced by exactly the same program.
Figure 3.12: This song has a straightforward verse, chorus, verse, chorus pattern.
Figure 3.13: While the output looks similar to Figure 3.12, the program that produced this page is much more efficient.
Figure 3.14: Variable $a keeps its value inside a function, but $b does not.

Chapter 4: Loops and Arrays: The Poker Dice Game

Figure 4.1: After the first roll, you can choose to keep some of the dice by selecting the checkboxes underneath each die.
Figure 4.2: The player has earned back some money with a full house!
Figure 4.3: This program counts from zero to one using only one print statement!
Figure 4.4: This program uses a for loop to count by five.
Figure 4.5: This program counts backwards from ten to one using a for loop.
Figure 4.6: Although the output of this program looks a lot like the basic for loop, it uses a different construct to achieve the same result.
Figure 4.7: The information displayed on this page is stored in two array variables.
Figure 4.8: The Fancy Old Man program uses a more compact structure that is easy to modify.
Figure 4.9: The program has two counters, which both read one when the program is run the first time.
Figure 4.10: After the user clicks the Submit button, both values are incremented.

Chapter 5: Better Arrays and String Handling

Figure 5.1: The user enters a list of words, and a size for the finished puzzle.
Figure 5.2: This puzzle contains all the words in the list.
Figure 5.3: Here's the answer key for the puzzle.
Figure 5.4: Although it looks just like normal HTML, this page was created with an array and a foreach loop.
Figure 5.5: This page uses associative arrays to relate countries and states to their capital cities.
Figure 5.6: This form has three basic fields. It will call the formReader.php program.
Figure 5.7: The formReader program determines each field and its value.
Figure 5.8: The user can choose origin and destination cities from select groups.
Figure 5.9: The program will look up the distance between the cities and return an appropriate value.
Figure 5.10: The pigify program lets the user type some text into a text area.
Figure 5.11: The program translates immortal prose into incredible silliness.

Chapter 6: Working with Files

Figure 6.1: The user is an administrator, preparing to edit a quiz.
Figure 6.2: The user has chosen to edit the Monty Python quiz.
Figure 6.3: The user is taking the Monty Python quiz. If you want to become a serious programmer, you should probably rent this movie. It's part of the culture.
Figure 6.4: The grading program provides immediate feedback to the user and stores the information in a file so the administrator can see it later.
Figure 6.5: The log retrieval program presents an activity log for each quiz.
Figure 6.6: The file has been loaded from the drive system and prettied up a bit with some CSS tricks.
Figure 6.7: The cartoonifier program shows what would happen if Shakespeare were a cartoon character.
Figure 6.8: This HTML file was automatically created by imageIndex.php.
Figure 6.9: The program created several form letters from a list of names and e-mail addresses.
Figure 6.10: The data file for this program was created in Notepad.
Figure 6.11: This diagram illustrates a user's movement through the quiz machine system.

Chapter 7: Using MySQL to Create Databases

Figure 7.1: The user can choose an option. Let's hop onto that sub...
Figure 7.2: Maybe the warehouse would have been a better choice after all.
Figure 7.3: This page provides information about each segment in the game, including links to directly edit each segment.
Figure 7.4: From this screen it is possible to change everything about a node. All the nodes that have been created so far are available as new locations.
Figure 7.5: The MySQL program connecting to a database.
Figure 7.6: The MySQL command line tool after I created the phonelist table.
Figure 7.7: MySQL tells you the operation succeeded, but you don't get a lot more information.
Figure 7.8: The result of the SELECT statement is a table just like the original plan.
Figure 7.9: The SOURCE command allows you to read in SQL instructions from a file.
Figure 7.10: This screen helps you connect to a data server.
Figure 7.11: It's easy to create a table and modify its structure with SQLyog.
Figure 7.12: You can edit a number of records easily in the edit view.
Figure 7.13: The export result set dialog allows you to save table data in a number of formats.
Figure 7.14: You can easily print HTML summaries of your data results.
Figure 7.15: I set up the phone list data as a tab delimited file and read it into Excel.
Figure 7.16: The XML form of the data generates HTML-like tags to describe the fields in the table.
Figure 7.17: The schema for a table describes important information about the table's structure.
Figure 7.18: From this dialog box you can generate code that will manufacture replicas of any database created or viewed with SQLyog.
Figure 7.19: The SELECT query is in the top right section, and the results are shown underneath.
Figure 7.20: This Query returns only the names and weapons.
Figure 7.21: If you know how to set up the query, you can get very specific results. In this case, the query selects only heroes with a laser pointer.
Figure 7.22: This query shows the entire database sorted by the weapon name.
Figure 7.23: This query sorts by the power in descending (reverse alphabetical) order.

Chapter 8: Connecting to Databases Within PHP

Figure 8.1: This HTML table is generated by a PHP program reading the database.
Figure 8.2: The listSegments program lists all the data and allows the user to choose a record for editing.
Figure 8.3: The edit record program displays data from a requested record and lets the user manipulate that data.

Chapter 9: Data Normalization

Figure 9.1: The badSpy database schema looks reasonable enough.
Figure 9.2: The badSpy database after I added a few agents.
Figure 9.3: A basic entity-relationship diagram for the spy database.
Figure 9.4: The entity-relationship diagram for the spy database.
Figure 9.5: This newer ER diagram includes a special table to handle the many-many relationship

Chapter 10: Building a Three-Tiered Data Application

Figure 10.1: The entry point to the Spy Master Database is clean and simple.
Figure 10.2: The results of the query are viewed in an HTML table.
Figure 10.3: From the main screen you can also access the table data with a password.
Figure 10.4: The editTable screen displays all the information in a table.
Figure 10.5: The user is editing a record in the agent table.
Figure 10.6: The user can see the newly updated record.
Figure 10.7: It's very easy to delete a record.
Figure 10.8: The add screen includes list boxes for foreign key references.
Figure 10.9: The user has successfully added an agent.
Figure 10.10: A state diagram of the "Spy Master" system.
Figure 10.11: This state diagram illustrates the relationship between PHP programs and functions in the spyLib code library.
Figure 10.12: The rToEdit function is simple, but produces dangerous output.
Figure 10.13: The smarter function doesn't let the user edit the primary key and provides a drop-down list for all foreign key references.

Team LiB
Previous Section Next Section

JavaScript Editor Javascript validator     Website design