前提・実現したいこと
PHP(CakePHP2)でボタンを押すと行の順序が入れ替わるシステムを作っています。
とりあえず↑のボタンだけでも動くようにしたいです。
index.ctp画面でボタンを押したとき、hiddenでその行のidをコントローラーに送りたいのですが、
$this->logで見てみると送ったつもりのidの値が取れていません。
PHP
1index.ctp 2<table> 3~省略~ 4 <td><?php echo $this->Form->create('Category'); 5 echo $this->Form->input('id'); 6 $id = $category['Category']['id']; 7 echo $this->Form->hidden('id',['value'=> $id]); 8 echo $this->Form->end(); ?> 9 </td> 10~省略~ 11<?php } ?> 12 13</table>
PHP
1Categories.Controller 2public function index() 3 { 4 if ($this->request->is(array('post','put'))) { 5 $id = $this->request->data['id']; 6 $this->log($id); 7 }
原因もしくは他に良い方法がわかる方がいたら教えてください。
よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー