PHP Object-Oriented Solutions
Chapter 4
This chapter focuses on using PHP filters to properly validate user input within forms and creates a cutom class that encapsulates the filtering functions.
Exericses
- Displaying the
filter_list()
array - The page displays the array contained within
filter_list()
. - Checking that a Variable Contains a Number
- The page displays a few ways to use filters with
filter_var()
. - Testing Other Filter Contstants
- The form displays the filters that can be applied to
filter_var()
and how they work with various inputs. The array for the dropdown is also displayed. - Filtering Multiple Variables
- The page displays examples of all the variataions of filtering, as well as the arrays created to flag the data.
- Validating Form Input
- The form is validated using the custom Validate class created throughout the chapter. If data is filled out incorrectly, the page returns with descriptive warnings.