文件add.tcp
<?php echo $this->Form->input('Issue.book_id',array('label'=>false,'class'=>'','type'=>'text','div'=>false,'value'=>$book_id)); ?>
IssuesController.php
function add()
{
if($this->request->data)
{
$data = $this->Issue->find('first', array('conditions' => array('Issue.book_id' => $book_id)));
$this->set('data',$data);
}
文件return.ctp
:
<?php echo $this->Form->create('issue',array ('action'=>'add')); ?>
<div class="rows">
<div class="cols col3">
BOOK ID
</div>
<div class="cols col3">
<?php echo $this->Form->input('Issue.book_id',array('label'=>false,'div'=>false,'error'=>false,'class'=>'c','type'=>'text','size'=>20)); ?>
</div>
</div>
<br />
<?php echo $this->Form->submit('RETURN',array('class'=>'but')); ?>
<?php echo $this->Form->end(); ?>
<?php ?>
如何在控制器中获取 book_id 值。实际上我从返回值传递值,我在 add.ctp 中获取该值,但在控制器中没有得到该问题。