I am able to get login and print session in the function but when i click on any other function my session get lost and it redirect me back to index page as each function is
Is the browser you're testing for Safari? I found a lot of reports that this is a common problem with Safari on iPad or iPhone, but also with Internet Explorer, which I've solved in the past.
When I encountered this in the past on Internet Explorer, I fixed it by setting the following option in config.php:
$config['sess_match_useragent'] = FALSE;
Apparently, the problem is caused by the fact that the session_id() is regenerated every time a user loads any page. By not checking for the useragent any more, apparently, CodeIgniter's native session class no longer performs that particular check-up.
Let me know if it worked!