What structure (MVC) should I use / simple app |
[eluser]jorre[/eluser]
I'm trying to build my first, relatively simple application with CI... Since I'm stuck at the moment... maybe I could just start over and ask the experts here first, what basic structure I should use to accomplish the following: 1. I want to display a simple form with 2 input fields (name/email) -> this works 2. When these are filled in, and user clicks the NEXT button, some 5 input boxes are shown (to create a poll) 3. When at least two of these are filled in, the user can press SAVE and the records are stored in database (name/email/poll_ID in 1 table, and poll_option_1, poll_option_2, poll_option_3, ... in another table, together with the poll_ID from the first table. That's pretty much what I want to do, if I accomplish that much with CI already, I think I'm ready to build my app further... So , what's the structure I should use for this? right now I have the following: 1 controller [has a function create1 [for step1] en a function create2 [for step2] 3 views -> one for step1, another for step2 [see above] and then a succes message [view 3] this works 50%, but I'm stuck with the other 50%. this works: - showing form 1 - showing form 2 this doesn't work -> saving data from form 1 AND 2 only after the final step -> when a user clicks SAVE in the last form/view I added my controller code to this post, just to give you an idea of how an OOP-newbie is trying to get his first CI-app online! Thanks a lot for helping me out here Code: <?php
[eluser]Edemilson Lima[/eluser]
I cannot saw where you did get the user submitted data. To do this, you must use: Code: $this->input->post('field_name'); Code: $this->session->set_userdata('var_name',$data); Code: $this->session->userdata('var_name');
[eluser]jorre[/eluser]
I'm still not there, but thanks a lot already for giving me the tip about using sessions... trying to implement that right now, but I can't seem to be able to pass data from my controller to my view... I keep getting "unknown variable" for some reason...
[eluser]Pascal Kriete[/eluser]
The variables in your view will be the keys of the array you pass in. Code: //Controller That should work. .
|
Welcome Guest, Not a member yet? Register Sign In |