-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 nickt66 wrote: > I have this scenario > > Page A > - Gathers data from user in form. > - It POSTS data to Page B > > Page B > - Writes POST data to db > - Displays POST data > > The problem is if the user goes from Page A -> Page B -> Page C (back > button) -> Page B then when they go back to Page B the POST data gets > written to the db again. Aside from the inefficiency, this is a problem > because stats are being incremented each time. So the data is being made > invalid by the user backing through Page B. > > I tried solving it like this: > > Page A > - Gathers data from user in form. > - It POSTS data to Page Z > > Page Z > - Writes POST data to db > - Redirects to Page B > > Page B > - Displays the POST data > > This works great in the sense that going from C back to B back to A doesn't > break the db data because Page Z is never hit again. > > But here's the problem - I need to POST the data from Page Z to Page B so > that it can display the data. The data in question is an array of JSON data. > > I tried using Zend_Http_Client and POST but that doesn't cause a redirect > from Z to B. Instead I get an error with the framework complaining it can't > find a view for Page Z (because of course, there isn't supposed to be one).
Zend_Http_Client is not used in this capacity, it is used to perform http request from the server (like curl). > So, if I'm in a controller action handler, how do I redirect to another > action handler and POST data to that handler? This is a common flow, the usual solution is to post from A to Z (save to database), then redirect to B (like you're doing) then have B read the data from the database for display. This should be fine in the vast majority of cases, there is an option to save the data to the a cache as well as the database if that is needed, but I really don't think it will be. - -- Brenton Alker PHP Developer - Brisbane, Australia http://blog.tekerson.com/ http://twitter.com/tekerson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkp7yJEACgkQ7bkAtAithuswgwCg2s5JJO7hYJ+p5BwqFTkha3JP ZPQAoJie3D5Nh4h9woYocN/MBEoFpWN9 =rKav -----END PGP SIGNATURE-----