* to look for form view files (this time we are * looking in the folder of the first example so we * can re-use our form template) */ phViewLoader::setInstance(new phFileViewLoader(dirname(__FILE__) . '/../registration')); /* * include and create our RegisterForm instance that * has all the validators embedded in it */ require_once 'RegisterForm.php'; $form = new RegisterForm('register', 'registerForm'); if ($_SERVER['REQUEST_METHOD'] == 'POST') { /* * data has been posted back, bind it to the form */ $form->bindAndValidate($_POST['register']); if ($form->isValid()) { /* * form data is valid, put your code to * register a new user here */ echo "<h1>Registration Complete!</h1>"; } } ?> <form action="/registration2/register.php" method="post"> <?php echo $form; // this will render the form ?> </form>