Saving Form Data for Later?
Permalink
I can't seem to figure out how to save form data in an array and store it for later in the database. I can get the current data, but then as soon as a new request is generated that is lost. Thinking its something simple, but can't find it by searching adodb or the forums. Thanks!
What's the context here? Assuming it's a block, you would need to create a table for the block (via the db.xml file) and save it to that table. There's tons of code in many of the built-in blocks that do this, basically something like this:
sorry, I guess I was a little unclear. It is in a block. Yes, I can do something like that, but then the data gets overwritten each time. I want to be able to get the form data from each of the submissions in an array, so that I can step through all the values. Thanks!
You want to use an INSERT statement in your SQL, not an UPDATE -- then nothing gets overwritten -- only new records added.
Note that you'll want to create another table (other than the block's primary table) for these, since there will hopefully be more than 1 form submission per block.
Note that you'll want to create another table (other than the block's primary table) for these, since there will hopefully be more than 1 form submission per block.