In this challenge assignment, you are asked to write validations, which will be called before data in the pages table is created or updated, and to display any validation errors that are found.
- [Instructor] We're ready for another challenge assignment.…This time, your challenge is to take the work…that we've done in 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 tables.…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 will 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.…Make sure that on those forms,…
- Organizing project files
- Including and requiring files
- Working with URL parameters
- Encoding dynamic content
- Modifying headers and page redirection
- Creating forms and processing form data
- MySQL basics
- Using PHP to access database tables
- Creating, reading, updating, and deleting database records with PHP
- Validating data
- Preventing SQL injection
Skill Level Beginner
1. Start a Database-Driven Project
2. Build Web Pages with PHP
3. Headers and Redirects
4. Build Forms with PHP
5. MySQL Basics
6. Use PHP to Access MySQL
7. CRUD with PHP
8. Validate Data with PHP
9. Prevent SQL Injection
Next steps1m 8s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.