Nothing in particular jumps out at me in the code... have you checked
to make sure that the form data is being stored in $this->data
properly when you submit? No extra or missing arrays within arrays?
On Jul 13, 3:05 am, "Feris Thia" <[EMAIL PROTECTED]> wrote:
> On 7/13/07, majna <[EMAIL PROTECTED]> wrote:
>
>
>
> > Must be something else. Paste controller code.
>
> Hi Majna,
>
> This is my code
>
> ==============================================================
> <?php
> class ProductsController extends AppController {
>
> var $name = 'Products';
> var $helpers = array('Html', 'Form' );
>
> function index() {
> $this->Product->recursive = 0;
> $this->set('products', $this->Product->findAll());
> }
>
> function view($id = null) {
> if (!$id) {
> $this->Session->setFlash('Invalid id for Product.');
> $this->redirect('/products/index');
> }
> $this->set('product', $this->Product->read(null, $id));
> }
>
> function add() {
> if (empty($this->data)) {
> $this->set('users',
> $this->Product->User->generateList());
> $this->render();
> } else {
> $this->cleanUpFields();
> if ($this->Product->save($this->data)) {
> $this->Session->setFlash('The Product has
> been saved');
> $this->redirect('/products/index');
> } else {
> $this->Session->setFlash('Please correct
> errors below.');
> $this->set('users',
> $this->Product->User->generateList());
> }
> }
> }
>
> function edit($id = null) {
> if (empty($this->data)) {
> if (!$id) {
> $this->Session->setFlash('Invalid id for
> Product');
> $this->redirect('/products/index');
> }
> $this->data = $this->Product->read(null, $id);
> $this->set('users',
> $this->Product->User->generateList());
> } else {
> $this->cleanUpFields();
> if ($this->Product->save($this->data)) {
> $this->Session->setFlash('The Product has
> been saved');
> $this->redirect('/products/index');
> } else {
> $this->Session->setFlash('Please correct
> errors below.');
> $this->set('users',
> $this->Product->User->generateList());
> }
> }
> }
>
> function delete($id = null) {
> if (!$id) {
> $this->Session->setFlash('Invalid id for Product');
> $this->redirect('/products/index');
> }
> if ($this->Product->del($id)) {
> $this->Session->setFlash('The Product deleted: id
> '.$id.'');
> $this->redirect('/products/index');
> }
> }
>
> }
>
> ?>
> ==============================================================
>
> Thanks for any suggestion !
>
> Regards,
>
> Feris
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---