0

I want to pass data from one function to another function in same controller.And then show that data on a view.This is my code parts.But it gives errors in view.Please can you help me?

Model

function getEmail($logindata)
 {
  $emailentered=$logindata['emailpost'];
  return $emailentered;
 } 

Controller

public function Login()
 {
  $this->load->view('header');
  $this->load->view('userLogIn');

  if($_POST) {
   $logindata=array(
     'emailpost'=>$_POST['email'],
     'passwordpost'=>$_POST['password']
   );

   $login_confirm=$this->systemModel->loginManagement($logindata);

            $emailgot=$this->systemModel->getEmail($logindata);
            $data['emailgot']=$emailgotvalue;

   if($login_confirm){
    $this->user($data);
   } 

  }

  $this->load->view('footer');
 }


public function user($data=array())
 {
  $this->load->view('header');


  $data['emailgot'];


  $this->load->view('user',$data);
  $this->load->view('footer');
 } 

View

<?php echo form_input(array('name'=>'email','readonly'=>'true','value'=>$emaigot));?> 
3
Contributors
4
Replies
26
Views
4 Years
Discussion Span
Last Post by diafol
0

@ pritaeas:Thanks for your reply.Finally solved it.The mistake was in the Model :) Anyway thansk again

0

And i'm asking a small question although it's not relevant to this topic.I want to update the time of the database 'isCreated' field when new user get registered.So i'm confusing which time to use?Server time or user's time?Plz can you help me?

2

server time. The time that the user sees (if you want this) should be sent via the timezone set by the user in their profile (if you have this set up for them).

e.g.

user table

user_id
username
...
register_datetime
user_tz (use this to modify the datetime [or the alternative format] as seen by the user)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.