Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5934099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:03:59+00:00 2026-05-22T15:03:59+00:00

How to pass variable between two functions in same controller? Do I need to

  • 0

How to pass variable between two functions in same controller?

Do I need to use $this->session->set_flashdata is this right way to go ?

function load() {
    $this->userhash = $this->uri->segment(3);
}

function save() {
    $query_customer = $this->Customers->get_customer($this->userhash);
}

sorry if this is a basic stuff, but I am still learning.

I need to edit my question

In Ivan link, that I also googled out

there is a code which goes something like this

function index() {
    $this->msg = 'data';
    $this->testme();
}

function testme() {
    echo $this->msg;
}

and its works, but I can not call $this->testme() directly in index(), so I can not load save() in load()

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:04:00+00:00Added an answer on May 22, 2026 at 3:04 pm

    Passing data between two functions in my controller class

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My onclick function works beautifully when i pass one variable and doesn't respond once
can't seem to get the syntax right in order to pass the AttID variable.
I need to pass a regex substitution as a variable: sub proc { my
Can we pass variable number of arguments to a function in c?
I need to access signed in username and pass, which are saved in session
I have this ConstantData class which holds my JSON indexes, I need to pass
How can I pass a variable number of args to a yield. I don't
I want to pass a variable to a UIButton action, for example NSString *string=@one;
We are trying to create a web-service that we plan to pass a variable
Possible Duplicate: Pass a PHP string to a Javascript variable (and escape newlines) I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.