Chapter 6. Building Scalable Websites

In this chapter, we will cover the following topics:

  • Creating a generic form element generator
  • Creating an HTML radio element generator
  • Creating an HTML select element generator
  • Implementing a form factory
  • Chaining $_POST filters
  • Chaining $_POST validators
  • Tying validation to a form

Introduction

In this chapter, we will show you how to build classes that generate HTML form elements. The generic element generator can be used for text, text areas, passwords, and similar HTML input types. After that, we will show variations that allow you to pre-configure the element with an array of values. The form factory recipe will bring all these generators together, allowing you to render an entire form using a single configuration ...

Get PHP 7 Programming Cookbook 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.