I have a button on page x and page y that redirects to page z. On page z, I have a form that needs filling out. Upon saving, I want to redirect to page x or y (whichever on
Store information about the pages your user has been visiting, so you can retrieve it later. Probably the best place to do that is in the session.