From the course: PHP with MySQL Essential Training: 1 The Basics

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Display validation errors

Display validation errors

- [Instructor] In this movie, we'll talk about how you display any validation errors you have back to the user. The first thing about a validation errors is that we want to let the user know what they are with the idea that we want them to fix it and try again. So we want to show them the same form that they submitted again, and we want to give them back the values that they submitted to us, not the original database values, but the values they provided so they can see what's wrong. If we said something was blank, then it ought to look blank for them so they can fill it in. The second thing we want is we want to tell them what the errors were. There are a couple of ways we could point that out. We could indicate the errors at the top of the page as a bulleted list. Here's the five things you need to fix. That's the approach that we're going to take and that's kind of what we started by doing in the last movie where we just built up a simple errors array of all the things that are…

Contents