Update your cake to the latest commit from 1.2 branch.

On Oct 16, 9:49 am, Adwin  Wijaya <[EMAIL PROTECTED]> wrote:
> Hi,
> just add an id (your surrogate / primary key) as hidden field if you
> want to do editing. may be the cakephp will check if there is no Id
> then it will do the inserting instead of updating ... :)
>
> -------------
> adwin
> wysmedia.com
> kompani.net
> --------------
>
> On Oct 16, 11:08 am, Aroha <[EMAIL PROTECTED]> wrote:
>
> > I am on version 1.2 the alpha build. I am attempting to edit a post.
> > My form is as follows:
>
> > <?php
> > echo $form->create('Post', array('action' => 'edit'));
> > echo $form->input('title', array('label' => 'Title', 'size' => '30'));
> > echo $form->input('body', array('label' => 'Post', 'rows' =>
> > '10','cols' => '40'));
> > echo $form->submit('Update');
> > echo $form->end();
> > ?>
>
> > If I dont add "array('action' => 'edit')" in create and I looked at
> > the source the action was add. However, when I submit this form, the
> > SQL that is generated is:
>
> > INSERT INTO `posts` (`title`,`body`,`created`,`modified`) VALUES
> > ('This is the title','This is the body','2007-10-16
> > 12:59:43','2007-10-16 12:59:43')
>
> > Any suggestions, on how to get this form to update rather than insert?
> > Perhaps, I need a hidden id variable somewhere?


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

Reply via email to