I'm coding up a small script that'll take form data and do something with it. If it fails, it shows the error and the form again. If it succeeds, it'll show a success message.
The backend code is using classes that'll throw exceptions if there's an error with the form data. The calls to the classes will be wrapped in a try{} catch{}.
What would be the best way to show the form twice?
I need something like:
If form submitted:
Try:
Add the account via class
Catch:
Echo the error
Show the form
Echo succcess
Else:
Show the form