###前提・実現したいこと
cakephpのformヘルパーを用いて、aタグでhiddenを使用したいのですが、どのようにすればいいでしょうか。
###該当のソースコード
<h1>todoリスト</h1> <hr> <?php echo "<br/><br/>"; echo $this->Form->create('Task',array('url'=>array('action'=>'add'))); echo $this->Form->input('Task.title',array('label' => 'リスト名: ','placeholder'=>'31文字以内で入力')); echo $this->Form->submit("リストの作成"); echo $this->Form->end(); echo "<br/><hr>"; ?> <?php for ($i=0; $i < count($data); $i++) { $task = $data[$i]['Task']; echo "<a href=", '""'," onclick=", '"',"document.Todo.submit();return false;", '">', "{$task['title']}", "</a>"; echo $this->Form->create('Todo',array('url' => array('controller' => 'todo', 'action' => 'index'))); echo $this->Form->hidden('Todo.task_id',array('value' => $task['id'])); echo $this->Form->end(); echo "<br/>"; echo "<hr>"; } ?>
class TasksController extends AppController { // モデル public $uses = array('Task','Todo','Status'); // ページネーション public $paginate = array( 'Task' => array( 'page' => 1, 'limit' => 10, 'sort' => 'created', 'direction' => 'desc', 'recursive' => 0 ), 'todo' => array( 'page' => 1, 'limit' => 10, 'sort' => 'created_at_todo', 'direction' => 'desc', 'recursive' => 0 ) ); // ホーム画面の処理 public function index(){ $data = $this->paginate('Task'); $this->set('data',$data); } }
###試したこと
###補足情報(言語/FW/ツール等のバージョンなど)
上記のようにコードを書いたのですが、$this->Form->createら辺で,シンタックスエラーで出てしまいます。
syntax error, unexpected '}', expecting ',' or ';'
以下のページをみてやってみたのですが、、、
http://blog.goo.ne.jp/xmldtp/e/0884dbe92721ab84cb27d212ca631094