将数据推送到显示错误的页面

时间:2016-05-04 08:59:19

标签: php codeigniter

我正在使用codeigniter控制器将数据推送到页面

public function trial(){
            /* after commiting now show them the next page which will directly allow them to invest */
                            $usertable =$this->user_profile->getUserTable();               
                            $userId = $usertable['ORIG_ID'];
                            $facebookId = $this->Facebook->getUser();
                            $sidebarData = array(
                                'userName' => $this->user_profile->getUserName(), 
                                'facebookId' => $facebookId, 
                                'caller' => 'investment_bucket'
                        );
                         $headerData = array(
                            $this->history->getPreviousPageInArray(),
                            'userName' => $this->user_profile->getUserName(),
                            'facebookId' => $facebookId 

                        );
                            $investAmount = 100;
                            $loanPeriod = 60;
           $investdata = array(
                                'investAmount' => $investAmount ,
                                'loanPeriod ' => $loanPeriod,
                                'pathName' => 'invest'
                            );

                            $this->load->view('header', $headerData);   
                            $this->load->view('borrower_sidebar_view', $sidebarData);
                            $this->load->view("invest_created_basket_view",$investdata);
                            $this->load->view('footer');  
        }

但是在它显示的加载页面上,

  

遇到PHP错误严重性:通知消息:未定义变量:loanPeriod文件名:views / invest_created_basket_view.php   行号:9

这是我加载数据的地方。

<input type ="text" value="<?php echo $investAmount; ?>" 
<input type ="text" value="<?php echo $loanPeriod ; ?>"

我无法弄清问题是什么。

1 个答案:

答案 0 :(得分:5)

你有一个简单的拼写错误。它是数组键'loanPeriod '

中的尾随空格
$investdata = array(
    'investAmount' => $investAmount ,
    'loanPeriod' => $loanPeriod,
    'pathName' => 'invest'
);