You’ve got a couple of PHP programs running, and have a handle on how PHP can interact with an HTML form. Still, although you’re a little more comfortable with how PHP as a whole interacts with web servers and web browsers, what’s actually going on in those PHP scripts? It’s time to dig a good deal deeper and start to understand what’s going on in the code you’re writing. In this chapter, you’re going to get comfortable with a lot of the PHP syntax. That means learning what special words—usually called keywords—you type into your programs and what each one of those keywords instructs PHP to do.
Fortunately, this learning doesn’t mean you can’t still build interesting programs that run in a web browser. In fact, because almost everything that’s done with PHP involves web pages, all of your scripts in this chapter will accept information from a web form and work with that information. So, you’re not just learning PHP; you’re learning to write web applications.
In sayHelloWeb.php, you used the following line to get the value of a variable called “name” from the sayHello.html web form:
You might remember that
$_REQUEST is a special PHP variable that lets you get information from a web request (Check Things Out Locally). You used it to get one particular piece of information—the user’s name—but it can do a lot more.
You can find the finished example code for this section on this book’s Missing ...