开发者

Why do I get these errors:?

My error code is:

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 {
va开发者_StackOverflow社区r $name = 'Users';
var $uses = array();
function index() {
if (!empty($this->data)) {
//data posted
echo $this->data['name'];
$this->autoRender = false;
}
}
}
?>


Did you set the $helpers in app_controller or users_controller? You need to include 'Form' in it. If you are using 2.0, I think you need to use $this->Html (not $html)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜