<?php include "autoloader.php"; if (!isset($_SESSION['robo'])) { header('Location: index.php'); exit; } if (isset($_POST['logout'])) { unset($_SESSION['robo']); header('Location: index.php'); exit; } $username = $_SESSION['robo']; $controller = new profileController(); $userInfo = $controller->getUserInfo($username); if (isset($_POST['update'])) { // if any values are null, it will simply write null values to db, perfectly allowable //$firstname = $_POST['firstname']; //$lastname = $_POST['lastname']; //$email = $_POST['email']; //$cellphone = $_POST['cellphone']; $subteam = $_POST['subteam']; $fullname = $_POST['fullname']; $phone = $_POST['phone']; $gradyear = $_POST['gradyear']; $email = $_POST['email']; $pemail = $_POST['pemail']; $newUserInfo = array("UserFullName" => $fullname, "UserPhoneNumber" => $phone, "UserYear" => $gradyear, "UserParentsEmail" => $pemail, "UserEmail" => $email, "UserSubteam" => $subteam); // calls controller to input $controller->updateUserInfo($username, $newUserInfo); header('Location: profilepage.php');