Welcome Guest, Not a member yet? Register   Sign In
hi, i am trying to build a wizard or multi step form and some forms have use the upload
#1

[eluser]dinisptc[/eluser]
hi, i am trying to build a wizard or multi step form and some forms have use the upload

Code:
$id_proj=$this->projects_model->add($projectName,$adress1,$adress2,$postcode,$city,$country,$description,$status);

                $newdata = array(
                  'proj_id'  => $id_proj                  
                );

i am using session to save the id of the project

the problem and the solution that i am looking its to save the data only in the final step
the way i am doing i am saving the data on every step , if the user give up in the middle of the wizard useless data will be stored in the database

another problem its the upload of images inside the wizard, i cannot do this only at the end of the wizard


thanks

#2

[eluser]TheFuzzy0ne[/eluser]
Do your user's have to be signed in to use this wizard?

People will probably shout at me for this, but I think I'd just create a table:
Code:
+-----------+----------------+--------+
| `user_id` | `last_updated` | `data` |
+-----------+----------------+--------+
|    ...    |       ...      |  ...   |

Make sure that user_id and last_updated are both indexed.

user_id will be used to grab the data for the specific user (if any exists).
last_updated can be used to destroy old data if you want to, otherwise you could just keep it, since it's one row per user.
data will need to be a large text field, and you can use that to store a serialized array of data. You can pull the data, figure out which step someone is on, update it with any submitted data and then save it back to the database.

If users can only upload a single image, you can add another field (using a BLOB field type) to your existing table, otherwise, you're going to need a 1-to-many relationship, which will require an extra table.

Hope this helps.




Theme © iAndrew 2016 - Forum software by © MyBB