On Sun, Jul 22, 2012 at 8:19 AM, Guti Grewal <[email protected]> wrote:
>
> What I want to do is get the galleryid to be inserted into the images table,
> through a form, which you can see above once a gallery is added it redirects
> to images/add, I want to get the last inserted id into the form in the
> images/add form so that I am able to call on the related ones

$this->redirect(
        array(
                'controller' => 'images',
                'action' => 'add',
                'gallery_id' => $this->Gallery->getInsertID()
        )
);


Route::connect(
        '/images/add/:gallery_id',
        array(
                'controller' => 'images',
                'action' => 'add'
        ),
        array(
                'gallery_id' => '[0-9]+'
                'pass' => 'gallery_id'
        )
);

public function add($gallery_id = null)
{
        $this->set(compact('gallery_id'));
        ...
}

$this->Form->hidden('Image.gallery_id', array('value' => $gallery_id));

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to