Chapter 6. Generating Dynamic Web Pages

You’ve been building up quite a robust set of tools. You have PHP scripts to receive requests from your HTML forms. You have MySQL to store information from your users. You have regular expressions to massage information into just the formats you need, and some basic flow controls in PHP like if and for to let you build scripts that make decisions based on what information your users give you.

But at the end of the day, your goal in learning PHP and MySQL is probably to make dynamic and interesting web applications, and you’ve not done much of that yet. You’ve got a few interesting forms, but even those are pretty simple: take in some information and print it back out; accept a SQL query (and do that quite imperfectly).

Thankfully, you’ve got everything you need to start building pages that are built dynamically using your user’s information and full-fledged web applications. You can get information from your users, store it in a database, and even do some basic data manipulation. It’s time to put it all together into the web pages that folks expect: a place to enter their information, a place to see their information, and in most cases, a place to look at all related user information.

Revisiting a User’s Information

On Access Request Parameters Directly, you built a form that took in a user’s basic social media profile: a Twitter handle, a Facebook URL, and some basic contact information. That form is shown in Figure 6-1: it’s simple and easy ...

Get PHP & MySQL: The Missing Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.