Unset old user input if form is successfully submitted?

Hi!

I have a slim3 test setup here https://github.com/ArneAnka/slim-test And i can’t manage to unset input fields, if the form is validated and successfully submitted. It is an endless loop…

This is how the old input middleware looks like: https://github.com/ArneAnka/slim-test/blob/master/app/Middleware/OldInputMiddleware.php

Help is much appreciated on how to unset/remove $_SESSION[‘old’] if the form is validated and submitted without errors.

This works: https://github.com/ArneAnka/slim-test/blob/master/app/routes.php#L44

But i seems as a work around.

Any better solution?