0

can i pass form dropdown value in my controller and after this, i can send the value in my DB table....please help me i m new in cakephp here is my 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>'

1 Answer 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

Sign up to request clarification or add additional context in comments.

2 Comments

thanks for reply.....if i select the drop down value and submit a button dropdown can't save in DB and also if i check the form dropdown value shown 0,means if i select the value i remain selected....
$ipr_value=array('0'=>'0.0','1'=>'.1','2'=>'.2','3'=>'.3'); use like this may be solve ur issue and print request data in controller

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.