cakephp 下拉列表选择并提交不起作用?
我正在使用 cakephp1.3,我想在视图中显示下拉菜单。
<?php echo $this->Form->create('Ledger');?>
<?php $userNames = $this->requestAction('users/getUsers'); ?>
<fieldset>
<legend><h2><?php __('Lend'); ?></h2></legend>
<?php echo $this->Form->input('burID'); ?> <br>
<?php echo $this->Form->input('displayname', array('type'=>'select','options'=>$userNames,'label'=>"Borrower",'empty'=>'Select name....')); ?><br>
<?php echo $this->Form->input('amount');?> <br>
<?php echo $userNames;?> <br>
</fieldset>
<?php echo $this->Form->end(__('Submit', true)); ?>
它基本上从用户数据库中获取用户并显示在下拉列表中。现在我想在控制器中捕获该选定的名称。但是当我从控制器中捕获该名称时,它会给我“显示名称”(这是我导入到的字段名称)下拉)。我该如何解决这个问题?
I'm using cakephp1.3 and i want to display a dropdown in a view.
<?php echo $this->Form->create('Ledger');?>
<?php $userNames = $this->requestAction('users/getUsers'); ?>
<fieldset>
<legend><h2><?php __('Lend'); ?></h2></legend>
<?php echo $this->Form->input('burID'); ?> <br>
<?php echo $this->Form->input('displayname', array('type'=>'select','options'=>$userNames,'label'=>"Borrower",'empty'=>'Select name....')); ?><br>
<?php echo $this->Form->input('amount');?> <br>
<?php echo $userNames;?> <br>
</fieldset>
<?php echo $this->Form->end(__('Submit', true)); ?>
it basically get users from Users database and display in a dropdown.Now i want to catch that selected name in the controller.but when i catch that from the controller it gives me the "displayname"(this is my fieldname which i imported to the drop down).How can i solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的控制器中,您不应该通过
因为您通过表单提交了数据,所以您需要通过
Ledger
检索数据In your controller, you shouldn't be going through
Because you submitted the data through the form, you need to be retrieving data from through
Ledger