On 17/06/12 12:45, Srdjan Todorovic wrote:
On 17 June 2012 12:23, Chris Greencl@isbd.net wrote:
requests it and the client fills in the form. The trouble is that there's no direct way for the PHP script that created the form to get the result - at least there isn't in any of the environment/frameworks that I've used.
Back in the day when everyone generally thought PHP was a good language to do web development in, I played about a little with PHP.
A very dirty, hacky, nasty way to do this is to call the same php script, with your<form> having a hidden input field. The PHP script checks it and does different things depending on the value. As I said, very nasty.
I agree with Srdjan, can be very dirty and nasty. Not least by the fact the user can tweak the data while it's at their end. The main problem is, as I think you pointed out, there is no easy way of passing data from the form sent out, to the page that processes the result. Indeed the result may not even be processed on the same server as the one that prepared it.
If there is only a small amount of data then the hidden field will probably do, even if it is dirty, but if there is a lot of data that needs to be passed about then I would suggest using the old mainframe method of writing it all to a database record before you send the form perhaps with the key to that record sent in a hidden field or use session data to store the key. Then when the post data comes back you can recover all of the data stored in the database in the processing page. Obviously you now have a database overhead so you need to decide if it's worth it or not.
All of the large system database systems I've worked on do this write and read automatically by having it built into the screen skeleton processing or in the operating system itself.
Nev