Hi, I'm designing a travel document application ...
In this application, after we confirm user data, the application will assign
a travel document to this user.
Here's the related tables, documents and applicants tables
CREATE TABLE `applicants` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(30) NOT NULL,
`pob` varchar(25) DEFAULT NULL,
`dob` date NOT NULL,
PRIMARY KEY (`id`)
)
CREATE TABLE `documents` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`document_number` varchar(10) NOT NULL,
`approved_applicant_id` int(10) DEFAULT NULL,
`status` varchar(15) DEFAULT NULL,
`app_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP,
`created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
)
I have 2 controllers, namely ApplicantsController and DocumentsController.
Here's what I have in each of the controllers:
in ApplicantsController
function process() {
if(array_key_exists('confirm',$this->params['form'])) {
//insert form data to approved_applicants table
$this->ApprovedApplicant->set($this->data['Applicant']);
if($this->ApprovedApplicant->save()) {
$id = $this->ApprovedApplicant->id;
//redirect to DocumentsController and pass newly
inserted applicant id
}
}
in DocumentsController
function add() {
//get newly inserted applicant id
//save applicant data to documents table
}
i
What I know is that I can save applicant id in session variable ih
ApplicantsController and grab it in DocumentsController, but what i want to
know is:
Is there any other way to pass this variable from one controller
(ApplicantsController) to another controller (DocumentsController) ??
Any help would be appreciated..
I use cake 1.2
Thanks
--
View this message in context:
http://old.nabble.com/Passing-variable-from-a-controller-to-another-controller-tp28160538p28160538.html
Sent from the CakePHP mailing list archive at Nabble.com.
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
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
To unsubscribe, reply using "remove me" as the subject.