Ok, now I got it. The problem is that in the data array there isn't
the id, because the id is added automatically from the db or from cake
I don't know (it's an autoincrement int). Is there a way I can get the
id of the last inserted item?
Thanks
On 29 Ott, 15:49, Paolo <[EMAIL PROTECTED]> wrote:
> I can try that, but it should also work as I said isn't it?
>
> On 29 Ott, 15:41, senser <[EMAIL PROTECTED]> wrote:
>
> > Why don't you try to set some session variable with last inserted ID
> > and in custom_page to read the details for this ID
>
> > Paolo wrote:
> > > Hi all!
> > > I would like to modify the page cake shows after an item has been
> > > added successfully. I 've done something like:
>
> > > function add()
> > > {
> > > if (empty($this->params['data']))
> > > {
> > > ....
> > > $this->render();
> > > }
> > > else
> > > {
> > > if ($this->Item->save($this->params['data']))
> > > {
> > > $this->set('myVar','test');
> > > $this->redirect('/pages/custom-page);
> > > exit();
> > > }
> > > else
> > > {
> > > ....
> > > $this->render('edit');
> > > }
> > > }
> > > }
>
> > > But in the custom-page I cannot accesmyVAr. I also tried to set 'data'
> > > with params['data'], before and after the save, but it's always empty
> > > (or better, it's never there). Do you know why this is happening? I
> > > need this becaus in the custom page I want to add other things related
> > > to the newly added item (i.e. I have an object that belongTo Item, so
> > > after I added it I would like to add children to it.
>
> > > Thanks
> > > But in the custom-page I cannot
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---