protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
	{
		String action = request.getParameter("profileButton");
		
		switch (action)
		{
			case ("Create Profile"): //the user wishes to create a profile
			{
				String email = request.getParameter("email");
				String username = request.getParameter("username");
				String password = request.getParameter("password");
				String confirmPassword = request.getParameter("confirmPassword");
				String bio = request.getParameter("bio");
				
				if (!password.equals(confirmPassword)) //if the two passwords do not match
				{
					request.setAttribute("failMessage", "Error: passwords do not match");
					request.getRequestDispatcher("/register.jsp").forward(request, response);
					return;
				}
							
				if (registerMain.lookupEmail(email)) //if the email is already in the system
				{
					request.setAttribute("failMessage", "Error: already registered with email \"" + email + "\"");
					request.getRequestDispatcher("/register.jsp").forward(request, response);
					return;
				}
						
				if (registerMain.lookupUsername(username)) //if the username is already in the system
				{
					request.setAttribute("failMessage", "Error: already registered with username \"" + username + "\"");
					request.getRequestDispatcher("/register.jsp").forward(request, response);
					return;
				}
				
				//hash the password for security
				HashMain hashMain = new HashMain();
				String hashedPassword = hashMain.hashPassword(password);
				
				registerMain.createUser(email, username, hashedPassword, bio); //create the user and put them into database	
				break;
			}
			
			case ("Delete Profile"): //the user wishes to delete their profile
			{
				User user = (User)request.getSession().getAttribute("currentUser");
				
				registerMain.deleteUser(user.getEmail());
				request.getSession().removeAttribute("currentUser");
				request.getSession().invalidate();
				user = null;
				break;
			}
		}
		
		response.sendRedirect(request.getContextPath() + "/login");
		return;
	}