HELP! Prolbem of global variable |
[eluser]Unknown[/eluser]
I'm a beginner of CI, I declare a globals variable in controller like this <?php $aaa='0'; class Test extends CI_Controller { function __construct() { parent::__construct(); } ... then i change this global variable in one of the functions in this controller $GLOBALS['aaa']=$this->input->post('bbb'); in this function, i have checked the 'aaa' and the content of it has been changed to the value of 'bbb' which is input by the user. But when i use 'aaa' in other function, the value is unchanged, it is still 0 as initialized. what can i do if I want to use the new value of it? Pls give some helps, thx~
[eluser]Aken[/eluser]
I suggest you learn more about variable scopes, class properties, and other basic PHP items before venturing into CodeIgniter. Otherwise you're setting yourself up to do a lot of poor coding. |
Welcome Guest, Not a member yet? Register Sign In |