Member Avatar for anmol.raghuvanshi1

I am having registration form which is very long so i have divided into two parts at end of first part i have button continue.If user has filled all the fields and data in fields are correct he can click on continue button to fill remaining form.So after doing some R&D i found processing such form can be done in two ways 1) Through session 2)hidden input fields.So i decided to work upon 1.What i have done stored all the values of first part of form in session then when user reach on second part of form it will fill remaining parts of form then click on submit that remaining data of form fields is appended to session data which has already values of first part of form.

Now i have all my data in array i cannot dump array data directly to database.So i have must convert it to string.here i have two choices use serialize() function or json_encode().But using serialize() is not good as it creates problem in portablity so any way i used json_encode ()

Array
(
`    [camping_data] => {"__ci_last_regenerate":1441903125,"session_data":{"first_name":"some","last_name":"some","email_id":"some@gmail.com","password":"123123","addressline1":"ll","addressline2":"fffffffff","phone":"1231231234","country":"3","state":"3","zip":"324010"},"business_name":"tent gearrrrrrrrr","rental_description":"rrrrrrrrrrrrrr"}`
)

Now point of note that is my whole array data is converted into one string.but now what can i do to split this string and place data in database eg first_name goes to first_name field,password goes to password field and so on...

i followed this tutorial but it saves whole data of employee as string in one field data emp-data

/* my controller where for handling second part of form where remaining data is appended into session array **/

`$new_form=array();
           ` $new_form['business_name']=$this->input->post("business_name");
           ` $new_form['rental_description']=$this->input->post("rental_description");
`$this->session->set_userdata($new_form);
           ` $json_data['camping_data']=json_encode($this->session->all_userdata());

Hope above data is helpful and question is clear

I have database table having fields like first_name ,password,last_name and so on

Member Avatar for anmol.raghuvanshi1

does My above approach is right or there is something wrong with it just need some directions

Just understand that you ask a question about a specific framework. I have n idea about it , doesn't that framework have a community ?

Member Avatar for anmol.raghuvanshi1

But it's more general problem releated to Programming than framework.I just want Directions how i am appraoaching to problem is right or wrong.If wrong where.I have included the just for some information I have no problem in codeing but approach if i am doing it wrong all will be wasted!! :(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.