I am trying to create a form with Slim. I have These routes:
$app->get('/cats/new', '\CatController:new'); $app->post('/cats', '\CatController:create');
So the first one shows the input form and the second takes its input. The create method validates the input and should redirect back to the
new route on errors.
I am not yet sure how to redirect those error Messages to the new route. As far as I know there’s
$response->withRedirect(<TARGET>) but no way to add data.
How do I ideally structure those two methods? Should I just Show the form from within the create method? How do I pass the errors to
new (to show them inside the form)?
Thank you in advance.