Ok. I had already try the simple code about session, and now its work for code : <?php if (isset($_SESSION['hello'])){ echo "Session Variable Hello is ".$_SESSION['hello']; }
else{ $_SESSION['hello'] = 'LEMUNE'; } ?> But for my code in the first post (my first question), it still don't work. for you who don't remember my code: This is my code: function log_in() { $this->set('error',false); if($this->data) { $results=$this->Login->findByUsername($this- >data['Login'] ['username']); if($results && $results['Login']['password'] == md5($this- >data['Login']['password'])) { $this->Session->write('user',$this- >data['Login']['username']); $this->Session->write('usertype',$this- >data['Login'] ['login_type_id']); $this->Session->write('user_id',$this- >data['Login']['user_id']); $level=$this->Session- >read('usertype'); if($level==1) { $this->redirect('/ administrators/index'); exit(); } elseif ($level==2) { $this->redirect('/ sales_records/index'); exit(); } else { $this->redirect('/ company_records/index'); exit(); } } else { $this->set('error',true); } } } If i read the $user variable it give me the correct answer, but if i read the 2 and 3 variable ($usertype & $user_id) it didn't work. So my program didn't redirect. What's wrong? I also try to change my code : $level=$results['Login']['login_type_id']; and then i try to echo the session variable in the redirected view, it just give me the first one. this is the controller code on redirected function index() { //$username= //$level=$this->Session->read('usertype'); $this->set('level',$this->Session->read('user')); $this->set('User_Type',$this->Session- >read('usertype')); $this->set('User_Id',$this->Session->read('user_id')); } this is the code on index.thtml <p>welcome <?php echo 'how do you do.'; e($level); //for username e($User_Type); //for usertype e($User_Id); //for user id ?></p> <br> <?php echo $html->link('logout','/login/logout') ?> and the result is: CakePHP Rapid Development welcome how do you do.lemune logout --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---