> I know it is much appropriate if function is called by action
> but i dont know how to return the variable to view.
In most of my controllers I have a private __formData() function as
both the add() and edit() actions need various variables sent to the
view so this avoids repetition.
function __formData() {
$statuses = $this->Staff->Status->find('list', array(
'conditions'=>array('Status.option_list_id'=>'15'),
'fields'=>array('Status.value'),
'order'=>'Status.value ASC'
));
$this->set(compact('statuses'));
$ethnicities = $this->Staff->Person->Ethnicity->find('list', array(
'conditions'=>array('Ethnicity.option_list_id'=>'13'),
'fields'=>array('Ethnicity.value'),
'order'=>'Ethnicity.value ASC'
));
$this->set(compact('ethnicities'));
}
Your $this->set('numval',$numval); command sends the variable to the
view in a variable called $numval, but your redirect then reloads the
page and therefore loses that $numval variable. You can also send
data to the view by placing everything within the $this->data array
which is automatically available to the view.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---