Oops - I hit Send before I meant to.
Anyway, the line of code you posted:
<?php echo $html->link('edit', array('action' => 'edit', 'id' =>
$compatible['Compatible']['id'], 'product_id' =>
$product['Product']['id']))?>
What line of HTML does it generate? I think you will find the URL
generated is not what you want. The second argument you are supplying
is an array like this:
array(
'action'=>'edit',
'id' =>$compatible['Compatible']['id'],
'product_id' =>$product['Product']['id']
)
Instead, this should be (IMO):
array(
'controller'=>'compatibles',
'action'=>'edit',
$compatible['Compatible']['id'],
$product['Product']['id']
)
Notice that there are no array keys assigned to the to arguments
following the edit action.
And, the definition for the edit() function should be something like:
function edit($compatible_id, $product_id)...
Study the way the function $html->link() is called here:
http://book.cakephp.org/view/206/Inserting-Well-Formatted-elements
Scroll down to see link()
Ken
On Dec 18, 11:28 pm, kdubya <[email protected]> wrote:
> You are going to have to post more of your code before we can help
> more. What is on line 24 of edit.ctp? Show the entire edit() function
> from your compatibles controller.
>
> The line of code you supplied:><?php echo $html->link('edit', array('action'
> => 'edit', 'id' =>
>
> $compatible['Compatible']['id'], 'product_id' =>
> $product['Product']['id']))?>
>
> Ken
>
> On Dec 18, 4:13 pm, Dewayne Pinion <[email protected]> wrote:
>
> > On Fri, Dec 18, 2009 at 12:13 PM, kdubya <[email protected]> wrote:
> > > Try either:
> > > $this->redirect(array('controller' => 'compatibles', 'action' =>
> > > 'index', 'product_id:'.$product_id));
> > > which should result in a URL like:
> > > productsadmin/compatibles/index/product_id:3365
>
> > This would be the right address, but the edit view is not receiving the
> > product_id. I get the error:
>
> > Notice (8): Undefined variable: id [APP/views/compatibles/edit.ctp, line 24]
>
> > Code | Context
>
> > include - APP/views/compatibles/edit.ctp, line 24
> > View::_render() - CORE/cake/libs/view/view.php, line 662
> > View::render() - CORE/cake/libs/view/view.php, line 376
> > Controller::render() - CORE/cake/libs/controller/controller.php, line 773
> > Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 248
> > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 211
> > [main] - APP/webroot/index.php, line 88
>
> > This is the link that sends the info to the edit view:
>
> > <?php echo $html->link('edit', array('action' => 'edit', 'id' =>
> > $compatible['Compatible']['id'], 'product_id' =>
> > $product['Product']['id']))?>
>
> > --
> > Dewayne Pinion
> > Web/Software Guy
> > Trenton Technologyhttp://www.trentontechnology.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