PHP 5/MySQL Programming- P24:computer programming has often been seen as a difficult and arcane skill. Programming languages are difficult and complicated, out of the typical person’s reach. However, the advent of the World Wide Web has changed that to some extent. It’s reasonably easy to build and post a Web page for the entire world to see. The language of the Web is reasonably simple, and numerous applications are available to assist in the preparation of static pages | 93 The first style is much shorter and easier to type so it s the form most programmers prefer. The printForm Function The purpose of the printForm function is to print the form at the bottom of the HTML page. This form is pretty straightforward except for the need to place the hidden field for numPetals. function printForm global numPetals print HERE h3 How many petals around the rose h3 form method post input type text name guess value 0 input type hidden name numPetals value numPetals br input type submit form br a href target helpPage give me a hint a HERE end printForm This code places the form on the page. I could have done most of the form in plain HTML without needing PHP for anything but the hidden field. However when I start using PHP I like to have much of my code in PHP. It helps me see the flow of things more clearly print greeting print dice and print form for example . Chapter 3 Controlling Your Code ith Conditions and Functions 94 The Ending HTML Code PHP 5 MySQL Programming for the Absolute Beginner The final set of HTML code closes everything up. It completes the PHP segment the font the centered text the body and finally the HTML itself. font center body html Summary You learn a lot in this chapter. You learned several kinds of branching structures including the if clause else statements and the switch structure. You know how to write functions which make your programs much more efficient and easier to read. You know how to pass parameters to functions and return values from them. You can access global variables from inside functions. You put all these things together to make an interesting game. You should be very proud In the next chapter you learn how to use looping structures to make your programs even more powerful. CHALLENGES 1. Write a program that generates 4- 10- or 20-sided dice. 2. Write a program that lets the user choose how many sides a die has and print a random roll with the appropriate maximum values. Don t worry .