[eluser]cartalot[/eluser]
another approach - validate the data and update the database with each form
lots of reasons but start with the user of your forms
you need to validate the data from each form on the server before submitting to database
so if there is a validation problem with form 1
you want to stop the process right there, kick back form 1
and have them fill it out correctly before going to form 2, etc
sessions and cookies are necessary sometimes, but for a multistep form -
you have the perfect reason NOT to bother with them. one hidden form field can
contain a unique id - that use each in form.
for example, in your database table have a varchar field: uniqueid
in your controller BEFORE the first form is called
generate a unique id, this example generates a 10 character id
Code:
$['data']uniqueid = random_string( 'alnum', 10 );
and then in your form have a hidden field with the unique id value
Code:
echo form_hidden('uniqueid', $uniqueid );
validate the data from form 1
insert the uniqueid and form 1 to database
in the controller pass uniqueid value to -> $['data']uniqueid
so then its available for form 2 etc etc
then use that uniqueid to do the updates with each form
in other words, you wont need the record or row 'id' which you would typically use for an update
no cookies, no sessions, no problems :-)