课程: PHP with MySQL Essential Training: 1 The Basics
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Validate form values
- [Instructor] In this movie, we'll begin adding validation functions to our project. The first thing we should think about is where we want to put these validations. We want to validate the data before we create or update records in the database. That's the right place to enforce these rules. So the form data comes in from the user, we run our validations, and then we either create or update the records. Often, we want to use the same validations for both creating and updating. That's because the rules about what data is acceptable when we're creating record are usually the same rules about the data that's acceptable when we're updating a record. It's not always true, but most of the time it is. In that case, you want to put your validation code in a reusable function, that you can call it in both cases and the same rules would be applied. You wouldn't want to inadvertently have one set of rules for creating data and a different set of rules for updating data. And then if our…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。