HTML Forms

PHP was originally designed for use on the Internet, and although you can now use it for command-line apps and GUIs, its main purpose remains working on the web. When it comes to the web, HTML has ruled unchallenged for some years now as the de facto standard for displaying information, even more so now that WAP usage has evaporated. This means that if you want to write a front-end for your PHP web applications, you need to understand HTML.

Topics covered in this chapter are:

  • Form design using HTML

  • Sending and receiving form data with PHP

  • Splitting forms across pages

  • Validating input

Chapter contents

  1. 7.1. The state of play
  2. 7.2. What does it mean to be dynamic?
  3. 7.3. Designing a form
    1. 7.3.1. GET and POST
    2. 7.3.2. Available elements
    3. 7.3.3. A working form
  4. 7.4. Handling data
    1. 7.4.1. register_globals
    2. 7.4.2. Working around register_globals
    3. 7.4.3. Magic quotes
    4. 7.4.4. Data handling summary
    5. 7.4.5. Handling our form
  5. 7.5. Splitting forms across pages
  6. 7.6. Files sent through forms
  7. 7.7. Validating input
    1. 7.7.1. Client-side validation
    2. 7.7.2. Server-side validation
    3. 7.7.3. Validation in practice
    4. 7.7.4. Advanced variable validation using CTYPE
    5. 7.7.5. Key validation points
  8. 7.8. Form design
  9. 7.9. Summary
  10. 7.10. Exercises
  11. 7.11. Further reading
  12. 7.12. Next chapter

Want to learn PHP 7?

Hacking with PHP has been fully updated for PHP 7, and is now available as a downloadable PDF. Get over 1200 pages of hands-on PHP learning today!

If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!

Next chapter: The state of play >>

Previous chapter: Next chapter

Jump to:


Home: Table of Contents

Copyright ©2015 Paul Hudson. Follow me: @twostraws.