Send your post id here. i will work

function update($id = 0) {

if ( $_POST['a'] == "Save") {

                $this->Promoter->id =
$_POST['data']['Promoter']['promoter_id'];// this is imp step.

                $this->Promoter->save($this->data);


$this->redirect(array('controller'=>'promoters','action'=>'step_three'));

            }
}

your getting the data is correct. compare post data and table data. if id is
found it will update else it will create new id.

all the best.





On Wed, Jun 23, 2010 at 3:46 PM, mirfan <m.irfa...@gmail.com> wrote:

> this array i ma getting and not able to save
>
> Array
> (
>    [Campaign] => Array
>        (
>            [id] => 1
>            [name] => xcxcxz updated
>            [average_users] => 66666
>            [url] => http://abc.com
>        )
>
> )
>
>
>
> On Jun 23, 3:09 pm, mirfan <m.irfa...@gmail.com> wrote:
> > yah i have the id hidden field but not working
> >
> > On Jun 23, 2:14 pm, "Master Ram...!" <ramganga...@gmail.com> wrote:
> >
> > > Hi, first u have to get the ID. and related fields using hidden format.
> >
> > > you can refer this example.
> >
> > > controller:
> >
> > > function edit($id = null) {
> > >    if (!$id) {
> > >       $this->Session->setFlash('Invalid id');
> > >       $this->redirect(array('action'=>'index'), null, true);
> > >    }
> > >    if (empty($this->data)) {
> > >       $this->data = $this->Task->find(array('id' => $id));
> > >    } else {
> > >       if ($this->Task->save($this->data)) {
> > >          $this->Session->setFlash('The test has been saved');
> > >          $this->redirect(array('action'=>'index'), null, true);
> > >       } else {
> > >          $this->Session->setFlash('The test could not be saved.
> > >                                     Please, try again.');
> > >       }
> > >    }
> >
> > > }
> >
> > > view:
> > > <?php echo $form->create('tablename');?>
> > >    <fieldset>
> > >       <legend>Edit Test</legend>
> > >       <?php
> > >          echo $form->hidden('id');
> > >          echo $form->input('title');
> > >          echo $form->input('done');
> > >       ?>
> > >    </fieldset>
> > > <?php echo $form->end('Save');?>
> >
> > > try i will work.
> >
> > > On Wed, Jun 23, 2010 at 2:27 PM, mirfan <m.irfa...@gmail.com> wrote:
> > > > Hi guys,
> > > > Again getting a problem as i am new to cake,
> > > > I have a table having 10 fields, now i want to update three of them
> > > > but cake did not allow me to do so
> >
> > > > table structure
> >
> > > > campaigns
> > > > ----------------
> > > > id
> > > > name
> > > > users
> > > > url
> > > > type
> > > > category
> > > > logo
> > > > |
> > > > and so on
> >
> > > > now i just want to update users and url my form look like this
> >
> > > > <?php echo $form-
> > > > >create('',array('controller'=>'campaigns','action'=>'update'))
> > > > echo $form->input('Campaign.users');
> > > > echo $form->input('Campaign.url');
> > > > echo $form->submit('Save');
> >
> > > > ?>
> >
> > > > when i  debug($this->data) it gives correct values
> >
> > > > but the data is never been saved with the following code
> >
> > > > $this->Campaign->save($this->data) ;
> >
> > > > please help
> >
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> 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 cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com>
> <cake-php%2bunsubscr...@googlegroups.com<cake-php%252bunsubscr...@googlegroups.com>>For
> more options, visit this group at
> > > >http://groups.google.com/group/cake-php?hl=en
> >
> > > --
> > > Master Ram.
> > > Founder n Director of rgPlanets Pvt. Ltd.
>
> 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 cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Master Ram.
Founder n Director of rgPlanets Pvt. Ltd.

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to