$smarty->assign('programyear', intval(date('Y')) - 1); // last year $smarty->assign('states', $states); $smarty->assign('countries', $countries); $smarty->assign('message', null); // new user registration if ($_SERVER['REQUEST_METHOD'] != 'POST') { $user = new User(); $user->country = "United States"; $smarty->assign('user', $user); $smarty->display('register.tpl'); exit; } // create user and valaidate input $user = new User(); $msg = $user->fromPost(); if ($msg) { $errors = 'Please be sure that you provide all of the requested data. '; foreach ($msg as $e) { $errors .= '<br /> - ' . $e; } $smarty->assign('message', $errors); $smarty->assign('user', $user); $smarty->display('register.tpl'); exit; } // store user information if ($user->addUser()) { $_SESSION['Account'] = $user; header('Location: landing.php'); exit;