2011-08-23 1 views
0

내 오류 코드는 다음과 같습니다이유는 이러한 오류를받을 수 있나요 :?

Notice: Undefined variable: form in c:\AppServ\www\applogic\app\views\users\index.ctp on line 1

Fatal error: Call to a member function create() on a non-object in c:\AppServ\www\applogic\app\views\users\index.ctp on line 1))) (index.ctp)

<?php echo $form->create(null, array('action' => 'index'));?> 
<fieldset> 
<legend>Enter Your Name</legend> 
<?php echo $form->input('name'); ?> 
</fieldset> 
<?php echo $form->end('Go');?> 

(users_controller.php)

<?php 
class UsersController extends AppController { 
var $name = 'Users'; 
var $uses = array(); 
function index() { 
if (!empty($this->data)) { 
//data posted 
echo $this->data['name']; 
$this->autoRender = false; 
} 
} 
} 
?> 

답변

1

당신이 app_controller 또는 users_controller에서 $ 도우미를 설정 했습니까? 당신은 그것에서 '폼'을 포함해야합니다. 는 2.0을 사용하는 경우, 당신이 내가 V 2.0 사용 @ $ this-> html로 (하지 $ HTML)

+0

를 사용할 필요가 있다고 생각하고> $ this- 사용되는 HTML을하지만 무슨 일이 있었 지적 – magy