Hour 9. Working with Forms

Until now, the PHP examples in this book have been missing a crucial dimension. Sure, you know the basics, can set variables and arrays, create and call functions, and connect to MySQL to do great things with a database. But that's all meaningless if users can't reach into a language's environment to offer it information. In this hour, you look at strategies for acquiring and working with user input. On the World Wide Web, HTML forms are the principal means by which substantial amounts of information pass from the user to the server.

In this hour, you will learn

  • How to access information from form fields

  • How to work with form elements that allow multiple selections

  • How to create a single document that contains both an HTML form and the PHP code that handles its submission

  • How to save state with hidden fields

  • How to redirect the user to a new page

  • How to build HTML forms and PHP code that send mail

  • How to build HTML forms that upload files and how to write the PHP code to handle them

    Part III: Getting Involved with the Code