Tuesday, November 29, 2011

redirecting to diffrent form

Hi all,

I am new to cakephp and im building a basic jobseeking site, my
problem is, i have two form one for employee and second form is for
jobseeker, im saving common data such as firstname, surname, ect.. in
one table, after saving this data i want redirect to relative form
like for emloyee to job posting form, just like to know how can i
redirect this in controller add function.

$user_group is hidden past value from view.

function add($user_group) {
if (!empty($this->data)) {
$this->Cutomer->create();
if ($this->Cutomer->save($this->data)) {
$this->Session->setFlash(__('The cutomer has been saved', true));
if($user_group == '2'){
$this-
>redirect(array('controller'=>'employee','action' => 'add',$this-
>Cutomer->getLastInsertID()));
}else{
$this-
>redirect(array('controller'=>'jobseeker','action' => 'add',$this-
>Cutomer->getLastInsertID()));
}
} else {
$this->Session->setFlash(__('The cutomer could not be saved.
Please, try again.', true));
}
}
$users = $this->Cutomer->User->find('list');
$this->set(compact('users'));
}

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: