简体   繁体   中英

Cakephp: edit view inserting instead of updating

If I have an edit view that is inserting a row instead of updating a row, what do I need to check?

The id of the row I'm editing is being passed in on the url:

http://localhost/cakepf/schedules/edit/78

Here are the contents of $this->data that are being passed into the edit controller function:

Array
(
    [Schedule] => Array
        (
            [task_id] => 1
            [repeat_type_id] => 10
            [priority] => 
        )

)

task_id and repeat_type_id are required; priority is not.

You need to have a echo $this->Form->input('Schedule.id', array('type' => 'hidden')); so that CakePHP knows that you are editing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM