Shared front-side and server-side validation for PHP/JS