Welcome Guest, Not a member yet? Register   Sign In
View Not getting array data
#1

[eluser]Unknown[/eluser]
Ive been stumped on this for hours. I dont see anything wrong with my code. But someone please check it out. Im new to CI..
1.Controller stores data into an array like this:

$data['info'] = array(
'email' => $email,
'pass'=> $password,
'sb_status' => $this->Login_Model->getSBStatus(),
'sb_notification' => $this->setNotification($this->Login_Model->getSBStatus()),
'sb_update_time' => $this->Login_Model->getSBUpdateTime(),
'registration_status' => $this->Login_Model->getRegStatus(),
'account_number' => $this->ALF_Model->getAccountNumber(),
'company' => $this->LF_Model->getCompany(),
'last_name' => $this->LF_Model->getLastName(),
'first_name' => $this->LF_Model->getFirstName(),
'verified' => $this->Login_Model->getVerifiedStatus(),
'account_type' => $this->Login_Model->getAccountType(),
'sb_guid' => $this->Login_Model->getSBGuid());

2. I call another function in my controller called selectView and pass the array as a param like this
$this->selectView($data);

3. inside my selectView function here is the code
public function selectView($data)
{
$account_disable= $this->Login_Model->getAccountDisable();
$sb_disable= $this->Login_Model->getSBDisable();

if(strcasecmp ($account_disable, "yes") == 0 &&
strcasecmp ($sb_disable, "null") == 0 && strcasecmp($this->Login_Model->getSBStatus(),"sb_n_4c") ==0 && strcasecmp($this->Login_Model->getVerifiedStatus(),"yes") !=0)
{
//payment is ok but account not verified yet
$this->load->view('pending_verification', $data);


}//if compare strings
elseif ($this->Login_Model->getSBStatus()== -1) {
//user didnt pay at registration
//send to sb
$this->load->view('registration_payment', $data);




}//else if customer didnt pay at registration
elseif (strcasecmp($this->Login_Model->getSBStatus(), "sb_n_8b")
|| strcasecmp($this->Login_Model->getSBStatus(),"sb_n_8a")
|| strcasecmp($this->Login_Model->getSBStatus(),"sb_n_8c")
|| strcasecmp($this->Login_Model->getSBStatus(),"sb_n_8d") )
{
//account locked for non payment; subscription was cancelled
//send them to sb via auto login
$this->load->view('subscription_stop', $data);



}//elseif
elseif(strcasecmp ($account_disable, "no") == 0 && strcasecmp ($sb_disable, "no") == 0 )
{
//sucessful login
$this->load->view('successful_login', $data);



}//elseif
else
{
$this->load->view('error_view');
}
}//selectView

The view calls in green work perfect, A+. I'm able to retrieve data from the array from the view file. But the one call in red will not pass the array data. Cant grab the array data inside the view file. I even tried to replace the one view file that doesnt properly recieve the data with one that works (ex. $this->load->view('registration_payment', $data) )and no matter what view I call in place of $this->load->view('subscription_stop', $data); nothing will work. Please help.

This is my view file:
<h1>&lt;?php echo "Welcome, ".$info['first_name'] ."".$info['last_name']; ?&gt;</h1>

The above call works in all my view files:
successful_login
registration_payment

except
subscription_stop


Please help
#2

[eluser]Aken[/eluser]
There's no reason the $data array wouldn't pass right there unless there was something wrong with your code. Check to make sure there are no errors in your function or controller. Check that the view is actually being called. Check that the view is trying to retrieve the data properly.

And use [ code ] tags next time here on the forums Wink
#3

[eluser]Unknown[/eluser]
Thanks alot. I just figured it out. Code was working as designed, Im just a goof. Record in DB table wasn't populated with the info I was trying to show in my view.
And thats for the heads up on using the code tag. I will remember next time.




Theme © iAndrew 2016 - Forum software by © MyBB