我有一个addstudent.ctp文件来添加学生
echo $this->Form->create('Student');
echo $this->Form->input('FirstName');
echo $this->Form->input('LastName');
echo $this->Form->end('Register');
echo $this->Form->create('Address',array('controller'=>'addresses','action'=>'addaddress'));
echo$this->Form->end('NextAdressDetails',array('controller'=>'addresses','action'=>'addaddress'));
点击它之后会添加StudentsController的方法。必须将学生对象添加到会话中,并且应该重定向到同一页面。这样我就可以添加尽可能多的学生,所以我的问题是如何点击注册按钮,将多个学生添加到会话中。
答案 0 :(得分:0)
$students = $this->Session->read('Students');
if (!$students) {
$students = array();
}
$students[] = /* data */;
$this->Session->write('Students', $students);