Factored POST to take in and check input before adding to database