$util = new Util(); $validator = new Validator(); $signup = new Signup(); //Array of Error Messages $errors = array(); if ($util->isPostRequest()) { if (!$validator->emailIsValid($email)) { $errors[] = 'Email is not valid'; } if ($validator->emailIsEmpty($email)) { $errors[] = 'Email is required'; } if ($validator->passwordIsEmpty($password)) { $errors[] = 'Password is required'; } if ($signup->doesEmailExist($email)) { $errors[] = 'Email already exisits'; } if (count($errors) <= 0) { if ($signup->save($email, $password)) { $message = 'Signup complete'; } else { $message = 'Signup failed'; } } } ?> <?php include './templates/errors.html.php'; ?>