Ph: 786-539-6996

Adding seconds in cakephp 3 views

// VIEW
echo $this->Form->input('vlog_in_hours', array('type' => 'select',
    'options' => array_combine(range(0,23), range(0,23)),
));
echo $this->Form->input('vlog_in_minutes', array('type' => 'select',
    'options' => array_combine(range(0,59), range(0,59)),
));
echo $this->Form->input('vlog_in_seconds', array('type' => 'select',
    'options' => array_combine(range(0,59), range(0,59)),
));


//CONTROLLER
function whatever() {
    //...
    $data = $this->request->data['MyModel'];
    $time = $data['vlog_in_hours'].':'.$data['vlog_in_minutes'].':'.$data['vlog_in_seconds'];
    $this->request->data['MyModel']['vlog_in'] = $time;
    //...
    $this->MyModel->save($this->request->data);
    //...
}
September 5th, 2016 | aesio

Leave a Reply

Your email address will not be published.

13 − 1 =

Time Programmer Corp Since 2014 ®