课程: PHP with MySQL Essential Training: 1 The Basics
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Challenge: Validations
- [Instructor] We're ready for another challenge assignment. This time, your challenge is to take the work that we've done this chapter on validations and apply it to your pages so that we validate the data before we accept it and put it in the pages table. You'll want to begin by writing a validation function so that you can pass in an associative array that can take a look at that data and decide if there are any errors and it'll return any errors that come up. Don't forget that our pages table has columns for subject ID and content that our subjects table did not have. So make sure you consider how you might want to validate those. Once you've got that function written, then you'll want to make use of it. You'll want to validate data before you create a page, and also before you update a page. Once you have those validations in place and errors being returned, we'll be ready to display those errors back to the user. And you'll do that both on the new.php page and the edit.php page.…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。