Welcome Guest, Not a member yet? Register   Sign In
session value and pass argument to controller method
#1

Hello. I've a problem that could not solve yet...
In my app, there is 2 controller:
Main and User.
In Main controller, there is a method called method1 that generate a random number, put it in $data['random'] variable, also store in session user data ($this->session->set_userdata('random', $data['random'])). Now $data['random'] loaded in a view, in a form input. After submitting the form to User controller method, I retrieve random number that is sent via the form input, compare it with value in session. they are equal and no problem.
BUT, this scenario for method2 (in Main controller) that has a parameter, is failed!!! I mean, I have method2 in controller that passed a parameter to it, and like method1 generate random number and... but when I retrieve data that is sent and data in session, they are not equal!!!
Another thing, when I store a fixed number in $data['random'] (and as scenario is said, $this->session->set_userdata('random', $data['random'])), result of both method is good; data that is sent via form and data retrieve from session is equal.
I could not guess where is the problem, just a passed parameter is the difference between methods but...!
thanks.
Reply
#2

[quote pid='327099' dateline='1451464608']
method2 in controller that passed a parameter to it 

How you passed and what parameter you passed ??
[/quote]
Reply
#3

(12-30-2015, 01:50 AM)eboominathan Wrote: [quote pid='327099' dateline='1451464608']
method2 in controller that passed a parameter to it 

How you passed and what parameter you passed ??

[/quote]

In Main controller, there is an index method, that load a view file. In this view, I call Main controller method2 with parameter.

<a href="<?php echo base_url(); ?>main/method2/some_numeric_var">something</a>
Reply




Theme © iAndrew 2016 - Forum software by © MyBB