Welcome Guest, Not a member yet? Register   Sign In
common way to use form validation
#1

[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?
#2

[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.
#3

[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');
to organize them.
#4

[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.




Theme © iAndrew 2016 - Forum software by © MyBB