0

我可以在我的控制器中传递表单下拉值吗?之后,我可以在我的数据库表中发送值....请帮助我,我是 cakephp 的新手,这是我的 job_content.ctp

 echo'<div class="AcceptButtonFormData">'; 
    echo $this->Form->create('Job' ,array('action' => 'view')); 

    $ipr_value=array('0'=>0.0,'1'=>.1,'2'=>.2,'3'=>.3);

    echo $this->Form->input('IPR_teeth_pair12',array('type' => 'select','name'=>'drop12', 'options' => $ipr_value,'default'=>0)); 

    echo $this->Form->input('IPR_teeth_pair23',array('type' => 'select','name'=>'drop23', 'options' => $ipr_value,'default'=>0));

    echo $this->Form->input('IPR_teeth_pair34',array('type' => 'select','name'=>'drop34', 'options' => $ipr_value,'default'=>0)); 

    echo $this->Form->end();
    echo '</div>'
4

1 回答 1

1

yes you can save it. As per above form this will post to you controller action in view

public function view() {
    // Has any form data been POSTed?
    if ($this->request->is('post')) {
        // If the form data can be validated and saved...
        if ($this->Job->save($this->request->data)) {
            // Set a session flash message and redirect.
            $this->Session->setFlash('JobSaved!');
            $this->redirect('/jobs');
        }
    }

    // If no form data, find the recipe to be edited
    // and hand it to the view.
    $this->set('jobs', $this->Job->findAll());
}

below is just sudo code you can change as per you need and for more understanding you can visit cakephp.org

于 2013-07-26T05:21:30.657 回答