joejac
Posts: 242
|
| Posted: 01/06/2009, 1:44 PM |
|
Hello
I need a multi-step record form with 5 steps, one per page. The record, with all the fields entered on each step, has to be stored in a single MySQL database table at the end of the last step, the number 5, with the submit button. The record uses 2 keys: customer_id and customer_order_number.
Unfortunately the Multi-Step Registration example stores the information, not after the last step, but after the step one. http://examples.codecharge.com/ExamplePack/MultiStepReg...ration_desc.php
Can somebody help me with an easy way to store the record in the last step?
I use PHP5/MySQL5, any code example is very much appreciated.
Thanks a lot in advance
Best regards
joejac
|
 |
 |
Gena
Posts: 591
|
| Posted: 01/06/2009, 2:16 PM |
|
Quote joejac:
Hello
I need a multi-step record form with 5 steps, one per page. The record, with all the fields entered on each step, has to be stored in a single MySQL database table at the end of the last step, the number 5, with the submit button. The record uses 2 keys: customer_id and customer_order_number.
Unfortunately the Multi-Step Registration example stores the information, not after the last step, but after the step one. http://examples.codecharge.com/ExamplePack/MultiStepReg...ration_desc.php
Can somebody help me with an easy way to store the record in the last step?
I use PHP5/MySQL5, any code example is very much appreciated.
Thanks a lot in advance
Best regards
joejac
I don't think that you store the record in the last step...
BTW the solution can be following:
1. first step Record form - here you should obtain some unique ID for this new record OR get existing ID if you want to edit.
2-3-4 step -your Record forms should be in edit mode by passing ID as parameter or use some other way (cookie or session variable)!! (because you already have ID of this record)
4 step - edit mode. You can put Cancel button - in this way you need to DELETE your ID record from DB.
_________________
Gena |
 |
 |
Edd
Posts: 547
|
| Posted: 01/06/2009, 3:31 PM |
|
One of the alternate methods, if you don't have an large amount of data to capture, is to store the data in session objects (requires a lot of coding).
This way it is not stored until you want it stored.
Cheers
Edd
_________________
Accepting and instigating change are life's challenges.
http://www.syntech.com.au |
 |
 |
mentecky
Posts: 321
|
| Posted: 01/06/2009, 10:08 PM |
|
joejak,
The simplest method is just to put hidden fields in your forms with the same names as the forms before them. It makes a hell of a mess maintaining it... but it works.
Rick
_________________
http://www.ccselite.com |
 |
 |
joejac
Posts: 242
|
| Posted: 01/07/2009, 7:21 AM |
|
Hello, and thanks a lot to everybody for your kind responses.
I prefer to store the record at the end because the customer does not want a lot of incomplete orders.
Mentecky, I always prefer not to mess with CCS code so the less programming the better for me.
1.- Should I pass the parameters from one page to the next via URL and store them in the hidden fields via the corresponding $Tpl variable? If it is not this way, how?
2.- Why you said: "It makes a hell of a mess maintaining it"?
Best regards
joejac
|
 |
 |
datadoit
|
| Posted: 01/07/2009, 9:34 AM |
|
Store in a temp table and write to the permanent table when done. Purge
the temp table periodically.
|
|
|
 |
damian
Posts: 838
|
| Posted: 01/07/2009, 12:20 PM |
|
periodically run a search on your user db for all records without a certain value (eg incomplete) and delete those
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
mentecky
Posts: 321
|
| Posted: 01/07/2009, 2:44 PM |
|
joejac,
I whipped together some quick pages to demonstrate how my method would work. You can see it at: http://www.ccselite.com/test_page_1.php
test_page_1.php has 2 fields, field1 and field2. The form was created with the "Record" control on the "Forms" tab. Not with the Record Builder. You would create all but your last form this way. I also clicked on the box around the form and set it's Return Page to "test_page_2.ccs".
test_page_2.php has 2 visible fields, field3 and field4. It also has 2 hidden fields, field1 and field2. The hidden fields must be named the same as the prior page. CCS will automatically set the values for you if the fields are named the same. Here I clicked on the box around the form and set it's Return Page to "test_page_3.ccs".
test_page_3.php is just displaying the values using CCGetParam but, if you create your last page with the Record Builder this will generate the code for your INSERT. When selecting fields for the form pick all of the fields you filled out in the previous pages and any you want filled in this page. HINT: For fields entered in previous pages set their control type to hidden here to save a whole lot of editing in the designer.
That's it. Should work fine and doesn't require a temporary table.
The reason I called this "a hell of a mess" is if you add a field to the first page you have to remember to add hidden fields with the same name to every page after it.
Rick
_________________
http://www.ccselite.com |
 |
 |
joejac
Posts: 242
|
| Posted: 01/08/2009, 4:39 AM |
|
Hello to all, I do really appreciate your ideas, thank you, I learn a lot.
Mentecky, your solution looks to me convenient to implement, I thank you very much your valuable time invested in the nice examples that you did in www.ccselite.com please leave those examples a few days more. I begin inmediately to do your solution.
By the way, www.ccselite.com looks very nice with a lot of resources, as soon as I finish with this project I will look into it in more detail. I appreciate a lot the effort and contribution to CCS community that you and the other members are providing.
Best regards
joejac
|
 |
 |
mentecky
Posts: 321
|
| Posted: 01/08/2009, 4:44 AM |
|
joejac,
I'll leave them up there for a good while.
Thanks for the compliments.
Rick
_________________
http://www.ccselite.com |
 |
 |
joejac
Posts: 242
|
| Posted: 01/25/2009, 2:24 PM |
|
Hello Rick,
One additional question: Why I can not use the Record Builder and disable the Insert, Delete, Update?
Thanks a lot
joejac
Quote mentecky:
joejac,
I whipped together some quick pages to demonstrate how my method would work. You can see it at: http://www.ccselite.com/test_page_1.php
test_page_1.php has 2 fields, field1 and field2. The form was created with the "Record" control on the "Forms" tab. Not with the Record Builder. You would create all but your last form this way. I also clicked on the box around the form and set it's Return Page to "test_page_2.ccs".
......
Rick
|
 |
 |
mentecky
Posts: 321
|
| Posted: 01/26/2009, 4:28 AM |
|
joejac,
You probably can but I think CCS will end up generating a bunch of code for the database that you really won't be using. I guess it's just my personal preference to manually build each grid.
Rick
_________________
http://www.ccselite.com |
 |
 |
joejac
Posts: 242
|
| Posted: 02/15/2009, 7:43 PM |
|
Hello Rick,
I have 5 pages, maint1.php to maint4.php all of them pass back and forth the parameters very nice. I have not hidden the fields yet, so I can see everything and ensure is fine. Those pages were created with the Toolbox-Forms-Record not with the builder, that is ok.
I created maint5.php with the Record Builder, in order to finally insert the new long record. I see on the URL the parameters coming fine from maint4.php Unfortunately maint5.php fields gets populated with an already existing record, not with the ones from the URL, it is very strange to me. There are no default values set for any field of the form. I click Send and it updates the other record, it do not create a new one with the URL data.
I tried to create maint5.php with the Toolbox-Forms-Record, not the builder, I allowed the record form to Insert and the next button with the "Operation" = Insert but no record was stored when I clicked the button.
I double checked and form and fields names and IDs are the same in all pages.
I have a composite key: user_id and quotation_no there is not an auto increment primary key. I do not know if this can be a problem?
I am almost done, Any ideas on how to store the record?
Thanks and best regards
joejac
|
 |
 |
mentecky
Posts: 321
|
| Posted: 02/16/2009, 12:24 PM |
|
joejac,
Try leaving your user_id and quotation_no fields blank and setting them in "On Before Insert".
Rick
_________________
http://www.ccselite.com |
 |
 |
|