Hi,

I've got quite a fundamental problem when using Cake. I've searched
through the postings but no appropriate solution.

It's like this:

I've created an edit function in my controller and a corresponding
edit.thtml file. I've got 2 simple tables (abbreviated):

products (
  id int(11),
  name varchar(250),
  category_id int(11),
  price decimal(19,2),
  created DATETIME
  modified DATETIME
);

categories (
  id int(11),
  name varchar(250),
  parent_id int(11),
  created DATETIME
  modified DATETIME
);

PRODUCT belongsTo CATEGORY.
CATEGORY hasMany PRODUCT.

In the function edit() I sent two variables to the edit.thtml by doing
this:

                $this->params['data'] = $this->Product->read();
                $this->set('catedata',
$this->Product->Category->generateList());

In the edit.thtml view, the problem I got was with the $catedata
variable.
    echo $html->selectTag('Product/category_id', $catedata,
$html->tagValue('Product/category_id'));

I put it into a select tag like the above. When I went to the edit
page, it worked fine. However, when I tried to save the edited data, it
gave me an

"Notice: Undefined variable: catedata in
/home/gsa/public_html/cake/app/views/products/edit.thtml "

error. The data was not saved to the database.

I've double-checked everything but everything seems to be okay. Am I
missing something that I should've done?

Any help is appreciated :)


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to