The YensDesign blog has a recent post that steps you through the entire process (down to every detail in the code) of making a form validation script that checks things on both sides - PHP for the server-side and jQuery on the client.
We are going to learn how to validate your forms using PHP and jQuery in both sides: client side (using javascript with jQuery) and server side (using PHP). It will be interesting to see how to use regular expressions to validate different kind of e-mails, passwords and more.
The form they create (a href="http://yensdesign.com/tutorials/validateform/">demo here) is a generic "send a message" form with fields for name, email address, passwords and the message itself. All code - both PHP and Javascript - is provided.