My initial strategy at developing forms was like this: the form post back to the same page and in the page handler I start by looking for POST variables and taking appropriate actions, then display the page content. It was all looking rosy in the beginning. I would place a hidden field inside my form and the page to keep track of current state and I could implement a state machine on the page to display the page in View, Edit or Add states. But 2 months later my pages have turned into hideous stateful monsters, riddled with IFs and branches, impossible to maintain, the state exchanged between page and client in hidden fields has is 'weight challenged', I just can't stand how it all turned out.
What am I doing wrong? Is this inherently hard? I'm down a slippery slope of reinventing ASP web forms? How is this done properly?
The technology behind (PHP) is irrelevant. My question is basically how to do HTTP forms that do more than simply take 2 fields and forward you to a 'thank you' page.