• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Split form in many pages... better way?

#15
[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 :-)







Messages In This Thread
Split form in many pages... better way? - by El Forum - 07-02-2012, 08:16 AM
Split form in many pages... better way? - by El Forum - 07-02-2012, 08:30 AM
Split form in many pages... better way? - by El Forum - 07-02-2012, 08:55 AM
Split form in many pages... better way? - by El Forum - 07-02-2012, 09:39 AM
Split form in many pages... better way? - by El Forum - 07-02-2012, 11:01 AM
Split form in many pages... better way? - by El Forum - 07-02-2012, 11:21 AM
Split form in many pages... better way? - by El Forum - 07-02-2012, 11:25 AM
Split form in many pages... better way? - by El Forum - 07-02-2012, 11:54 AM
Split form in many pages... better way? - by El Forum - 07-02-2012, 11:59 AM
Split form in many pages... better way? - by El Forum - 07-02-2012, 12:23 PM
Split form in many pages... better way? - by El Forum - 07-03-2012, 12:21 AM
Split form in many pages... better way? - by El Forum - 07-03-2012, 01:08 AM
Split form in many pages... better way? - by El Forum - 07-03-2012, 02:03 AM
Split form in many pages... better way? - by El Forum - 07-03-2012, 02:04 AM
Split form in many pages... better way? - by El Forum - 07-03-2012, 09:21 AM
Split form in many pages... better way? - by El Forum - 07-03-2012, 10:52 AM
Split form in many pages... better way? - by El Forum - 07-03-2012, 11:28 AM
Split form in many pages... better way? - by El Forum - 07-06-2012, 02:59 AM
Split form in many pages... better way? - by El Forum - 07-06-2012, 01:01 PM
Split form in many pages... better way? - by El Forum - 08-18-2014, 09:03 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.