I have a addstudent.ctp file to add students
echo $this->Form->create('Student');
echo $this->Form->input('FirstName');
echo $this->Form->input('LastName');
echo $this-&开发者_如何学Pythongt;Form->end('Register');
echo $this->Form->create('Address',array('controller'=>'addresses','action'=>'addaddress'));
echo$this->Form->end('NextAdressDetails',array('controller'=>'addresses','action'=>'addaddress'));
after clicking on it is going to add method of StudentsController.it has to add student object to session and should redirect to same page.like this i can able to add as many students as possible ,so my problem is to how to add the multiple students into session whenever clicks on register button.
$students = $this->Session->read('Students');
if (!$students) {
$students = array();
}
$students[] = /* data */;
$this->Session->write('Students', $students);
精彩评论