2016-05-04 51 views
0

我使用笨控制器將數據推送到頁面顯示錯誤

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文件名:觀點/ invest_created_basket_view.php 行號:9

這裏是我在哪裏加載DAT一個。

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

我不知道問題是什麼。

+0

'loanPeriod'typo。更改爲'loanPeriod'(刪除尾部空白) –

回答

5

你有一個簡單的錯字在那裏。它是陣列中的尾部空間鍵'loanPeriod '

$investdata = array(
    'investAmount' => $investAmount , 
    'loanPeriod' => $loanPeriod, 
    'pathName' => 'invest' 
); 
+0

哦,該死的,注意到很長一段時間!謝謝! – Aurora

+0

沒問題,想問一下你的查看代碼,然後我才注意到那個錯字xD –

+0

嘿我修好了這個錯字,但是我還是沒有得到loanPeriod的查看 – Aurora