In this chapter, we will be looking at how to better validate posted form data, by extending the Model class. This allows us to relegate a task typically involved with the data of our application to the model where data (or business logic) should dwell.


  • We need to extend our Model class to include methods of posted form data validation, and to apply this validation before allowing rows to be added, updated, or deleted.
  • We need to create the action and view for the settings page.


Getting validation right can be a tricky thing, particularly when the aim of MVC is to allow for good separation of concerns. ...

Get Pro PHP MVC 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.