O'Reilly logo

jQuery 1.3 with PHP by Kae Verens

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting up jQuery validation from PHP

Client-side validation is very useful, and saves a lot of time. However, if there is no server-side validation to make sure that the input is correct, then there is no guarantee that the data you collect will be correct.

In this case, PHP is very useful to us to manage the form. When you think of it, the form would be defined in the following three areas:

  • In the document's head section as part of the JavaScript
  • In the body section in the HTML form
  • On the server side when validating and submitting the code

If any one of these was different to the rest, then there would be problems.

The simplest way to solve this is to have a single definition of the form in PHP, from which the HTML and JavaScript should be built. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required