Validation

warning: Creating default object from empty value in /home/coredogs/public_html/modules/taxonomy/taxonomy.pages.inc on line 33.

Handling errors

Using databases adds more things that can go wrong. In this lesson, we’ll see how you can handle database errors.

We’ll talk about two new types of errors:

  • Database connection errors
  • SQL errors

You can check for both.

We’ll also talk about simple server-side validation. Even if you can check all data on the client, you should check it on the server as well. To foil Evil Doers.

Better client-side error display

See more about:

Learn:

  • How to report errors in a professional way.
  • How page-wide, global error messages help the user.
  • How JavaScript functions make error reporting easier to program.

Form and PHP validation on one page

See more about:

Learn:

  • How to have the HTML for the form and the PHP validation code on the same page.
  • How to collect error messages in a single variable, rather than treating them all separately.

A PHP validation function

See more about:

Learn:

  • How to write a PHP validation function.
  • How to call it.

Complete validation

See more about:

This lessons shows a complete form validation example.

  • It shows good error messages.
  • Some error checking is on the server side. Some is on the client side.
  • Bother server-side and client-side error messages are reported in the same way. That’s done by writing PHP code that calls JavaScript code.

Validation

See more about:

You know how to grab data from text fields, and do things with them. But what if the user doesn’t type anything? Or says that his or her age is -15?

In this lesson, you learn how to:

  • Check whether a field has a value.
  • Check whether a number is OK.

Improving validation

See more about:

Learn how to do a sequence of checks on a value passed to a PHP page.

Basic server-side validation

See more about:

Topics covered:

  • Understand why you need server-side and client-side validation.
  • Know how to check whether a value sent to the server is a valid number.

Client-side validation

Learn:

  • How to get form data into JavaScript variables.
  • How to check that data for errors.
  • How to report errors to the user.

Lessons

How to...


Dogs