Handling an HTML Form

Now that I have an HTML form, I’ll write a bare-bones PHP script to handle it. When I say that this script will be handling the form, I mean that it will do something with the data it receives. In this chapter, the scripts will reiterate the data back to the Web browser, but in later examples, it will be stored in a MySQL database, checked against previously stored values, sent in emails, and more.

Registering Globals

In earlier versions of PHP, the register_globals setting was turned on by default. This feature gave PHP an ease of use by automatically turning form inputs into similarly named variables, like $name or $email (as opposed to having to refer to $_REQUEST['name'] and $_REQUEST['email'] first).

As of version ...

Get PHP and MySQL for Dynamic Web Sites: Visual Quickpro Guide, Second Edition 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.