Create a category'; if($_SESSION['signedIn'] == false | $_SESSION['userLevel'] != 1 ) { //the user is not an admin echo 'Sorry, you do not have sufficient rights to access this page.'; } else { //the user has admin rights if($_SERVER['REQUEST_METHOD'] != 'POST') { //the form hasn't been posted yet, display it echo '
'; } else { //the form has been posted, so save it $sql = "INSERT INTO categories(catName, catDescr) VALUES(?, ?)"; $stmt = $conn->prepare($sql); $stmt->bind_param('ss', $_POST['catName'], $_POST['catDescr']); if(!$stmt->execute()) { //something went wrong, display the error echo 'Error' . $conn->error; } else { echo 'New category succesfully added. Go Home.'; } } } include 'footer.php'; ?>