I currently am working on a shopping cart. The checkout process is a sequence of forms, in which one form POSTs to the next form in order to move the customer to checkout. However, I'm starting to rethink the decision to POST to the next form, and am thinking maybe it's better to have each form POST to itself, and then redirect. Here are my thoughts:
Pros of posting to the next form:
- Single point of entry for adding things to cart, for example. Reduces code duplication.
- Treats each form as a REST-like resource (collection?) that can be added to.
Pros of posting to same form:
- All content on the page can be saved. For example, if a user modifies a quantity in the cart and hits checkout instead of update cart, that number will still be saved.
- More control over the flow-- if a user needs to be directed to a different checkout page based on their membership level or whatever-- that can be done.
Which is better? To POST to the next form in the sequence, or POST to the same form and redirect? Or should some forms work one way, and some another? Am I overthinking this? (probably)