create function to handle all redirects. todo: loop to handle submitted form/ check for errors