2011-09-21 59 views
1

當我點擊提交在註冊頁面,我越來越"Notice (8): Undefined variable: id [APP\views\merry_parents\report_card.ctp".CakePHP的:從控制器傳遞變量時未定義的變量錯誤查看

我只是試圖從merry_parents_controller通過$this->data['MerryParent']['id']使用$this->set($id,$this->data['MerryParent']['id']);

的report_card視圖

有人能告訴我我做錯了什麼嗎?提前致謝。

下面是我的代碼:

//report_card.ctp 

<?php 
    echo 'HALLO'; 
    echo $id; 
?> 

回答

3

用途:

$this->set('id', $this->data['MerryParent']['id']); 

第一個參數是想要的名稱作爲一個字符串,而不是作爲一個變量。

+0

謝謝!那工作。 :) – vaanipala

相關問題