![]() |
common way to use form validation - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: common way to use form validation (/showthread.php?tid=26967) |
common way to use form validation - El Forum - 01-28-2010 [eluser]crwtrue[/eluser] I have a working ci-application which previously worked like this: In the index view there are some links. Those links are like this cicontroller/function1/value1/value2. After user have selected a link my program shows a view with two forms. In that function that creates that view program reads value1 and value2 to variables using uri->segment() function. When user submits either form then function2 or function3 is called in cicontroller and view2 or view3 is created. Well i wanted to use form validation class so i changed the program like this: Function1 now reads value1 and value2 to an cisession then i also added if-else if-else sentence. So if Form1 is submittend then it will be validated and if it is valid i first unset_userdata on session and then i call function2 like $this->function2(). If the form is not valid i create the same view using value1 and value2 which are in session. And i do the same thing with form2. So there aint really a problem the program works fine like it used to but i am asking if this a smart way to proceed? common way to use form validation - El Forum - 01-28-2010 [eluser]crwtrue[/eluser] i change the thread name cause it didnt describe the post. any comments would be nice cause there is little info about standard way of making basic things like this in books. common way to use form validation - El Forum - 01-28-2010 [eluser]Jan_1[/eluser] i do see what you're doing, but i don't really know why. what for is that your best practice? i personally don't like to put a lot of data in the session. I do use a db-table with temporary data using Code: $this->input->ip_address() and $this->session->userdata('session_id'); common way to use form validation - El Forum - 01-29-2010 [eluser]crwtrue[/eluser] well i changed my ciapplication so that i can use form validation and i was just asking if those changes that i made in my ciapplication was good or not. |