Web-app: Error checking & going back to the correct page